Docstoc

TUTORIAL TUTORIAL ns 3

Document Sample
TUTORIAL TUTORIAL ns 3 Powered By Docstoc
					                              TUTORIAL
                                   ns-3-lte
                               author: Marco Mezzavilla
                                   mezzavil@dei.unipd.it




INTRO:

This guide has been written in order to support the installation of LTE module for ns-3 and
provide some useful tips to (hopefully) prevent any kind of trouble.
So far, two kinds of contributions are running in parallel:
    - Integration of 3GPP standardized functionalities
    - Network optimization: novel algorithms implementation + performance evaluation


LTE Module Structure:

All the material referred to LTE framework can be found here: ns-3-lte/src/devices/lte.

- examples: scripts used to show some basic functionalities;
- test: test files needed to validate the correctness of the code;
- helper: LTE helper scrpt, used to manage and associate the LTE technology to each device;
- model: the core of the framework, all the entities and functionalities implemented
          to define a reliable LTE stack (PHY-MAC-RLC-RRC)

Extending such framework, or just improving it, means that some files have to be edited, or
created from scratch. In the former case, to see the changes working, is only needed to
recompile (./waf), while in the latter case the wscript has to be opportunely edited before
recompilation.

Ns-3 can be configured with ECLIPSE, a useful environment that can be used to analyze ns-3
capabilities and easily debug. In this tutorial is presented the way to download, install and
configure such tool in order to have it correctly working.
ns-3-lte INSTALLATION:

- download the folder ns-3-lte and place it into your work_directory

- open the terminal and install some basic components (if needed)
  sudo apt-get install gcc g++ python python-dev mercurial valgrind

- install ns-3-lte
   cd work_directory/ns-3-lte
   ./waf

Eclipse (OPTIONAL) INSTALLATION:

- install the sun-java6-jre
  sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" && sudo
  apt-get update && sudo apt-get install sun-java6-jre sun-java6-jdk sun-java6-
  plugin sun-java6-fonts

- download ECLIPSE
  http://www.eclipse.org/downloads/ → download Eclipse IDE for C/C++ Developers

CONFIGURATION STEPS:

- Open eclipse
- Assign the workspace directory
- Create new C++ project
- Right click on it and import the folder ns-3-lte
- Select all and apply
- Click right on the project and click on properties
- Click on C/C++ build and configure the builder
- Uncheck the box Use default build command
- Uncheck the box Generate makefile automatically
- Write ${workspace_loc:/ns-3-lte/waf} in the build command
- Write ${workspace_loc:/ns-3-lte/build} in the build directory
- Click on the behaviour tab
- Remove the `all` option in front of the build checkbox and write `build`

- LIBRARY ASSOCIATION (LINUX-FEDORA users):
sudo ln -s /home/your_name/eclipse_workspace_name/ns-3-
lte_project_name/build/debug/libns3.so /lib/libns3.so

- LIBRARY ASSOCIATION (MAC OSX users)
sudo ln -s /Users/your_name/eclipse_workspace_name/ns-3-
lte_project_name/build/debug/libns3.dylib /usr/lib/libns3.dylib
HOW TO 'RUN' and 'DEBUG'

cd /work_directory/ns-3-lte/src/devices/lte/examples/



TERMINAL - 'Run':

To run example 'lte-device.cc', then:

./waf - - run lte-device


TERMINAL - 'Debug':

To debug example 'lte-device.cc', then:

./waf --run lte-device --command-template="gdb --args %s <args>"


Here is a list of commands to be used for debugging (GDB):

    •   b - Put a breakpoint at the current line
    •   b main - Put a breakpoint at the beginning of the program
    •   b N - Put a breakpoint at line N
    •   b +N - Put a breakpoint N lines down from the current line
    •   b fn - Put a breakpoint at the beginning of function "fn"
    •   d N - delete breakpoint number N
    •   info break - list breakpoints
    •   r - Run the program until a breakpoint or error
    •   c - continue running the program until the next breakpoint or error
    •   f - Run until the current function is finished
    •   s - run the next line of the program
    •   s N - run the next N lines of the program
    •   n - like s, but don't step into functions
    •   u N - run until you get N lines in front of the current line
    •   p var - print the current value of the variable "var"
    •   bt - print a stack trace
    •   u - go up a level in the stack
    •   d - go down a level in the stack
    •   q - Quit gdb
ECLIPSE - 'Run':

- Run → Run Configurations → C/C++ Application → give it a name and associate a project
by clicking on Search Project – then APPLY.
- Select the script_name and choose Environment, then New:
Name: LD_LIBRARY_PATH, or DYLD_LIBRARY_PATH in case of MAC OS x
Value: ${workspace_loc:project_name/build/debug}

ECLIPSE – 'Debug':

- Set a Breakpoint in the code, and click on the BUG icon
(make sure it is the right associated script)

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:16
posted:11/21/2011
language:Italian
pages:4