Showing posts with label Simulation. Show all posts
Showing posts with label Simulation. Show all posts

16.9.11

Installing ns-2.1a

Several sites while installing old ns version gives suggestion to install older version of gcc which is tricky in itself. Approached by my friend, I tried doing the same in several platforms which eventually failed to do anything good about it. Instead of going back on gcc version, it is much easier to modify ns code to fit in version 4 of gcc, only thing required is fix some portions of diffusion based routing schemes. This is the step I followed from scratch.

Some basic issues:
1. Samsung Sens X360 would not let me install dual boot ubuntu for some unknown reason. Yet to find solution for this. Interestingly it even converted the boot sequence that I saved in the BIOS setting.
2. My friend did several trials on cygwin based linux environment. Running simulation is very slow
3. Third attempt I chose vmware and install ubuntu over it.

For a freshly installed ubuntu ensure few libraries are installed:
sudo apt-get install libxt-dev
sudo apt-get install libx11-dev

Otcl compilation error (From  wiki)

 otcl.o: In function `OTclDispatch':
 /home/ns/ns-allinone-2.34/otcl/otcl.c:495: undefined reference to `__stack_chk_fail_local'



This error is because the linker being used is "ld -shared" instead of "gcc -shared". If you edit one line in otcl-1.13/configure, and rerun install, it should work:
 --- configure.orig      2009-11-02 12:14:52.556167945 -0800
 +++ configure   2009-11-02 12:17:28.966706099 -0800
 @@ -6301,7 +6301,7 @@
          ;;
      Linux*)
          SHLIB_CFLAGS="-fpic"
 -        SHLIB_LD="ld -shared"
 +        SHLIB_LD="gcc -shared"
          SHLIB_SUFFIX=".so"
          DL_LIBS="-ldl"
          SHLD_FLAGS=""


Follow the rest of errors handling in sunreset blog

For Error on red.cc
==> Follow the discussion on const char* to char* error on porting to gcc-4.4
in red.cc .. redefine p to const char *p


Error: X11/Xmu/WinUtil.h: No such file or  for nam installation
sudo apt-get install libxmu-dev


This should set you to start working in ns-2.1a with gcc-3.4 :). *Quick note: This is better done more easily with ns-2.31 patches. Lesson: don't hang on old versions, move on.













24.4.11

TKN EDCA and DSR simulation on ns-2.31

The mac-80211e.cc runs into assertion error since control packet of DSR and the data packets cannot be properly dequeued for transmission.

Preliminary: Applied only if the DTail queue is used instead of CMUPriQueue

Problem:  The control packets of DSR and the data packet cannot be extracted serially from the queue gets into race condition while accessing pkttx_[pri] in sendDATA() of mac-80211e.cc

Solution. Ensure all control packet transmission priority is assigned to appropriate priority (iph->prio() = 0 //for setting highest priority)


29.3.11

Application Profiling for Network Centric Warfare

References for simulation:
[1] Military Inter-vehicle communication with message priority using IEEE 802.11e 

Priority Type Examples
Pri(1) Combat - Combat occurrence
- Help request
- Additional force request
Pri(2) Alert - Enemy invasion
- Threat report
- Solider injury
Pri(3) Warning - Enemy appearance
warning
- Enemy pattern change
Pri(4) General - Survey report
- General situation rep

Interface specification

Interface IEEE802.11a
Data Rate 6 Mbps
Packet Payload Size 100 Bytes
Packet Generation Interval 0.1 second
Number of Transmission 40
nodes
RTS Threshold 256 Bytes
(no RTS in this experiment)
Channel 1
Buffer Size 256,000 bits

Application packet generation rate, model for traffic generation and quantity, packet inter-arrival time are not provided.

[2]QoS traffic specification from thesis "Scheduling in IEEE 802.11e Networks with Quality of Service Assurance"

Application Voice VBR H.261 Video FTP
Packet size (bytes) 160 660 1200
Mean Data rate (kbps) 64 200 350
Minimum Data rate (kbps) 25 150 250
Maximum Service Interval (ms) 25 30 35
Delay Bound (ms) 120 180 infinity

NS-2 Application Traffic Description for Exponetial/Pareto and CBR






16.2.11

NS-2 Rate setting for interface cards 802.11a/b/g

[Referred from Nabble Mailing List]
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.11a
  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. 

18.1.11

NS-3 Issues


25.10.07

NS2 Tips and Tricks!!

Disabling ARP
ns2 : mac/arp.cc

int
ARPTable::arpresolve(nsaddr_t dst, Packet *p, LL *ll)
{
// Disable ARP
hdr_cmn *ch = HDR_CMN(p);
mac_->hdr_dst((char*) HDR_MAC(p), ch->next_hop());
return 0;

ARPEntry *llinfo ;
...

31.7.07

NS2 tips and tricks (Debugging)

1. install tcl-debug
a. put the directory of "tcl-debug-1.9" parallel to ns-2. (Actually, it
can be put somewhere else).
b. it seems that tcl-debug needs to be installed manually, instead of ns
will compile it automatically, which is the impression I have from the
nsdoc, then follow the instruction about the installation note in
tcl-debug-1.9 directory, "./configure" and "make". It may not be necessary
to install tcl-debug to the system, since libtcldbg.a should have been
made and already in the directory "tcl-debug-1.9".

2. go into ns-2 directory and make ns again
a. ./configure --enable-debug --with-tcldebug=../tcl-debug-1.9
b. make clean
c. make

3. Tcl debugging
a. insert "debug 1" somewhere in the tcl script
b. #>gdb ns
c. (gdb)run myscript.tcl

4. C++ debugging
a. #>gdb ns
b. (gdb)break classname::memberfunction
c. (gdb)run myscript.tcl

12.7.07

NS2 Tips and Tricks

Reading from Scenario file to C++ (aodv.cc)
Scenario File test.tcl
$ns_ change-numifs 2
#Calling add-channel in ns-lib.tcl
$ns_ add-channel 0 $chan_(0) 0
$ns_ add-channel 1 $chan_(1) 1
set node_(0) [$ns_ node]
$node_(0) random-motion 0

# In ns-lib.tcl takes indexch ch and intchan (see above)
Simulator instproc add-channel {indexch ch intchan} {
$self instvar chan arrchan
set chan($indexch) $ch #chan takes NSObject
set arrchan($indexch) $intchan #arrchan takes integer
}
# In ns-lib.tcl write get-arrchan to be called from ns-mobilenode.tcl, returns array
Simulator instproc get-arrchan {} {
$self instvar numifs_ arrchan
if [ info exists numifs_ ] {
return [array get arrchan]
}

}
#in ns-mobilenode.tcl in add-target function I call get-arrchan
Node/MobileNode instproc add-target { agent port } {
---

#use array to retrieve array
array set intchanlist [$ns get-arrchan]

#teaching aodv routing agent about values in the inchanlist
if { $port == [Node set rtagent_port_] } {
for {set i 0} {$i < $numIfsSimulator} {incr i} {
$agent setchanlist $i $intchanlist($i)
}
---
---
}

Finally in command() of aodv.cc

else if (strcmp(argv[1], "setchanlist") == 0) {
int index_ch = atoi(argv[2]);
intchanList[index_ch] = atoi(argv[3]);
printf("%d:: channel %d\n", index, intchanList[index_ch]); //prints node-id and channel value
return TCL_OK; //dont' forget this!!!
}