more work
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sun Apr 05 16:27:42 2009 +0200 (10 months ago)
changeset 16dea59b022772
parent 15 011c3aec1b44
child 17 b61144c8cd7d
more work
Makefile
ns-3-doxygen.png
simulation-workflow.dia
test-random-variable.pdf
test-random-variable.py
tutorial.tex
     1.1 --- a/Makefile	Sun Apr 05 12:47:51 2009 +0200
     1.2 +++ b/Makefile	Sun Apr 05 16:27:42 2009 +0200
     1.3 @@ -4,15 +4,23 @@
     1.4  %.pdf: %.eps
     1.5  	epstopdf  --outfile=$@ $^
     1.6  
     1.7 +%.pdf: %.png
     1.8 +	convert $^ $@
     1.9 +
    1.10  %.emf: %.eps
    1.11  	pstoedit -pta -f "emf:-OO" $^ $@
    1.12  
    1.13  MAIN_SOURCE=tutorial.tex
    1.14 +DIA_SOURCES=simulation-workflow.dia
    1.15 +PDF_SOURCES=test-random-variable.pdf
    1.16 +PNG_SOURCES=ns-3-doxygen.png
    1.17 +
    1.18 +DIA_PDFS=$(addsuffix .pdf,$(basename $(DIA_SOURCES)))
    1.19 +PNG_PDFS=$(addsuffix .pdf,$(basename $(PNG_SOURCES)))
    1.20  MAIN_PDF=$(addsuffix .pdf,$(basename $(MAIN_SOURCE)))
    1.21 -
    1.22  all: $(MAIN_PDF)
    1.23  
    1.24 -$(MAIN_PDF): $(MAIN_SOURCE)
    1.25 +$(MAIN_PDF): $(MAIN_SOURCE) $(DIA_PDFS) $(PDF_SOURCES) $(PNG_PDFS)
    1.26  	pdflatex $^
    1.27  
    1.28  force:
    1.29 @@ -25,4 +33,5 @@
    1.30  SUFFIXES=.aux .log .nav .out .pdf .snm .toc
    1.31  clean:  
    1.32  	-for suffix in $(SUFFIXES); do rm -f $(basename $(MAIN_SOURCE))$$suffix 2>/dev/null; done
    1.33 +	-rm -f $(DIA_PDFS) 2>/dev/null
    1.34  	-rm -f *~ 2>/dev/null
     2.1 Binary file ns-3-doxygen.png has changed
     3.1 Binary file simulation-workflow.dia has changed
     4.1 Binary file test-random-variable.pdf has changed
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test-random-variable.py	Sun Apr 05 16:27:42 2009 +0200
     5.3 @@ -0,0 +1,9 @@
     5.4 +#!/usr/bin/env python
     5.5 +import pylab 
     5.6 +import ns3
     5.7 +
     5.8 +rng = ns3.NormalVariable(10.0, 5.0)
     5.9 +x = [rng.GetValue() for t in range(100000)]
    5.10 +
    5.11 +pylab.hist(x,100)
    5.12 +pylab.show()
     6.1 --- a/tutorial.tex	Sun Apr 05 12:47:51 2009 +0200
     6.2 +++ b/tutorial.tex	Sun Apr 05 16:27:42 2009 +0200
     6.3 @@ -13,7 +13,8 @@
     6.4  \begin{frame}{Tutorial schedule}
     6.5  Tuesday 7th:
     6.6  \begin{itemize}
     6.7 -\item 14h00-16h00: Feature tour
     6.8 +\item 14h00-14h30: The goals of ns-3
     6.9 +\item 14h30-16h30: Overview of ns-3 features
    6.10  \item 16h00-16h30: Pause
    6.11  \item 16h30-17h30: And end-to-end tour of a simulation
    6.12  \end{itemize}
    6.13 @@ -24,4 +25,243 @@
    6.14  \end{itemize}
    6.15  \end{frame}
    6.16  
    6.17 +\begin{frame}{Goals of this tutorial}
    6.18 +
    6.19 +\begin{itemize}
    6.20 +\item Learn about the ns-3 project and its goals
    6.21 +\item Understand the software architecture, conventions, and basic usage of ns-3
    6.22 +\item Read and modify an example ns-3 script
    6.23 +\item Learn how you might extend ns-3 to conduct your own research
    6.24 +\item Provide feedback to the ns-3 development team
    6.25 +\end{itemize}
    6.26 +
    6.27 +\end{frame}
    6.28 +
    6.29 +\begin{frame}{Assumptions}
    6.30 +Some familiarity with:
    6.31 +\begin{itemize}
    6.32 +\item C++ and Python programming language
    6.33 +\item TCP/IP
    6.34 +\item Unix Network Programming (e.g., sockets)
    6.35 +\item Discrete-event network simulation
    6.36 +\end{itemize}
    6.37 +\end{frame}
    6.38 +
    6.39 +\part{The goals of ns-3}
    6.40 +
    6.41 +\begin{frame}
    6.42 +\partpage
    6.43 +\end{frame}
    6.44 +
    6.45 +\begin{frame}{}
    6.46 +
    6.47 +Need to explain experimentation, simulation, overall workflow.
    6.48 +Try to explain what ns-3 is trying to achieve, and where it 
    6.49 +wants to be relative to other solutions
    6.50 +
    6.51 +\end{frame}
    6.52 +
    6.53 +
    6.54 +\part{Overview of ns-3 features}
    6.55 +
    6.56 +\begin{frame}
    6.57 +\partpage
    6.58 +\end{frame}
    6.59 +
    6.60 +\begin{frame}{A typical simulation workflow}
    6.61 +
    6.62 +\includegraphics[width=10cm]{simulation-workflow}
    6.63 +
    6.64 +\end{frame}
    6.65 +
    6.66 +\section{Introductory Software Overview}
    6.67 +
    6.68 +\begin{frame}{The basics}
    6.69 +
    6.70 +\begin{itemize}
    6.71 +\item ns-3 is written in C++
    6.72 +\item Bindings in Python
    6.73 +\item ns-3 uses the waf build system
    6.74 +\item simulation programs are C++ executables or python scripts
    6.75 +\item API documentation using doxygen
    6.76 +\end{itemize}
    6.77 +\end{frame}
    6.78 +
    6.79 +\begin{frame}{The waf build system}
    6.80 +Waf is a Python-based framework for
    6.81 +configuring, compiling and installing
    6.82 +applications: a replacement for other tools such as
    6.83 +Autotools, Scons, CMake or Ant.
    6.84 +\begin{itemize}
    6.85 +\item Homepage with documentation: \url{http://code.google.com/p/waf/}
    6.86 +\item For those familiar with autotools:
    6.87 +\begin{itemize}
    6.88 +\item ./configure $\rightarrow$ ./waf -d [optimized|debug] configure
    6.89 +\item make $\rightarrow$ ./waf
    6.90 +\item make test $\rightarrow$ ./waf check
    6.91 +\end{itemize}
    6.92 +\item Can run programs through a special waf shell: this gets the library paths right for you:
    6.93 +\begin{itemize}
    6.94 +\item ./waf --run simple-point-to-point
    6.95 +\item ./waf --shell
    6.96 +\end{itemize}
    6.97 +
    6.98 +\end{itemize}
    6.99 +\end{frame}
   6.100 +
   6.101 +  
   6.102 +\begin{frame}{APIs}
   6.103 +
   6.104 +We use Doxygen: 
   6.105 +\begin{itemize}
   6.106 +\item last stable release: \url{http://www.nsnam.org/doxygen-release/index.html}
   6.107 +\item development tree: \url{http://www.nsnam.org/doxygen/index.html}
   6.108 +\end{itemize}
   6.109 +\includegraphics[width=7cm]{ns-3-doxygen}
   6.110 +\end{frame}
   6.111 +
   6.112 +\begin{frame}[fragile,allowframebreaks]{Getting started}
   6.113 +
   6.114 +Install all needed tools:
   6.115 +\begin{block}{Ubuntu}
   6.116 +\begin{verbatim}
   6.117 +sudo apt-get install build-essential g++ python mercurial 
   6.118 +\end{verbatim}
   6.119 +\end{block}
   6.120 +
   6.121 +\begin{block}{Windows}
   6.122 +\begin{itemize}
   6.123 +\item cygwin
   6.124 +\item python
   6.125 +\item mercurial
   6.126 +\end{itemize}
   6.127 +\end{block}
   6.128 +
   6.129 +\break
   6.130 +
   6.131 +Download and build development version:
   6.132 +\begin{block}{}
   6.133 +\begin{verbatim}
   6.134 +hg clone http://code.nsnam.org/ns-3-allinone
   6.135 +cd ns-3-allinone
   6.136 +./download.py
   6.137 +./build.py
   6.138 +cd ns-3-dev
   6.139 +./waf distclean
   6.140 +./waf configure
   6.141 +./waf
   6.142 +\end{verbatim}
   6.143 +\end{block}
   6.144 +
   6.145 +Useful options:
   6.146 +\begin{itemize}
   6.147 +\item \code{./waf -d optimized configure}
   6.148 +\item \code{-j\#} where \# is number of cores
   6.149 +\item \code{./waf --help} shows you other options
   6.150 +\end{itemize}
   6.151 +
   6.152 +\break
   6.153 +
   6.154 +Running programs:
   6.155 +\begin{itemize}
   6.156 +\item build/VARIANT:
   6.157 +\begin{itemize}
   6.158 +\item Programs compile against build/VARIANT/ns3/*.h
   6.159 +\item Programs link against shared library build/VARIANT/libns3.so
   6.160 +\item Programs are built as build/VARIANT/PATH/program-name
   6.161 +\end{itemize}
   6.162 +\item Using \code{./waf --shell}
   6.163 +\begin{block}{}
   6.164 +\begin{verbatim}
   6.165 +   ./waf --shell
   6.166 +   ./build/debug/samples/main-simulator
   6.167 +\end{verbatim}
   6.168 +\end{block}
   6.169 +\item Using \code{./waf --run}
   6.170 +\begin{block}{}
   6.171 +\begin{verbatim}
   6.172 +   ./waf --run examples/csma-bridge.cc
   6.173 +   ./waf --pyrun examples/csma-bridge.py
   6.174 +\end{verbatim}
   6.175 +\end{block}
   6.176 +\end{itemize}
   6.177 +
   6.178 +\end{frame}
   6.179 +
   6.180 +\section{Introductory Architecture}
   6.181 +
   6.182 +\begin{frame}{}
   6.183 +
   6.184 +\end{frame}
   6.185 +
   6.186 +\begin{frame}{Simulation basics}
   6.187 +
   6.188 +\begin{itemize}
   6.189 +\item Simulation time moves discretely from
   6.190 +event to event
   6.191 +\item C++ functions schedule events to occur at
   6.192 +  specific simulation times
   6.193 +\item A simulation scheduler orders the event
   6.194 +  execution
   6.195 +\item \code{Simulation::Run} gets it all started
   6.196 +\item Simulation stops at specific time or when
   6.197 +  events end
   6.198 +\end{itemize}
   6.199 +\end{frame}
   6.200 +
   6.201 +\begin{frame}[fragile]{Scheduling events}
   6.202 +
   6.203 +In \code{samples/main-simulation.cc}:
   6.204 +\begin{block}{}
   6.205 +\begin{verbatim}
   6.206 +static void random_function (MyModel *model)
   6.207 +{
   6.208 +  // print some stuff
   6.209 +}
   6.210 +int main (int argc, char **argv)
   6.211 +{
   6.212 +  MyModel model;
   6.213 +  Simulator::Schedule (Seconds (10.0), 
   6.214 +                       &random_function, &model);
   6.215 +  Simulator::Run ();
   6.216 +  Simulator::Destroy ();
   6.217 +}
   6.218 +\end{verbatim}
   6.219 +\end{block}
   6.220 +\end{frame}
   6.221 +
   6.222 +\begin{frame}[fragile]{Random variables}
   6.223 +
   6.224 +Currently implemented distributions:
   6.225 +\begin{itemize}
   6.226 +\item Uniform: values uniformly distributed in an interval
   6.227 +\item Constant: value is always the same (not really random)
   6.228 +\item Sequential: return a sequential list of predefined values
   6.229 +\item Exponential: exponential distribution (poisson process)
   6.230 +\item Normal (gaussian)
   6.231 +\item Log-normal
   6.232 +\item pareto, weibull, triangular,
   6.233 +\item ...
   6.234 +\end{itemize}
   6.235 +\begin{columns}
   6.236 +\begin{column}{0.75\textwidth}
   6.237 +\begin{block}{}
   6.238 +\begin{verbatim}
   6.239 +import pylab 
   6.240 +import ns3
   6.241 +rng = ns3.NormalVariable(10.0, 5.0)
   6.242 +x = [rng.GetValue() for t in range(100000)]
   6.243 +pylab.hist(x,100)
   6.244 +pylab.show()
   6.245 +\end{verbatim}
   6.246 +\end{block}
   6.247 +\end{column}
   6.248 +\begin{column}{0.25\textwidth}
   6.249 +\includegraphics[width=3cm]{test-random-variable}
   6.250 +\end{column}
   6.251 +\end{columns}
   6.252 +
   6.253 +\end{frame}
   6.254 +
   6.255 +
   6.256  \end{document}