more crap
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu Feb 26 17:10:03 2009 +0100 (11 months ago)
changeset 44ac1b8b45457
parent 3 227f88ed3691
child 5 d6a17c05a731
more crap
wns3-helper.cc
wns3.tex
     1.1 --- a/wns3-helper.cc	Thu Feb 26 16:41:57 2009 +0100
     1.2 +++ b/wns3-helper.cc	Thu Feb 26 17:10:03 2009 +0100
     1.3 @@ -14,7 +14,6 @@
     1.4    CommandLine cmd;
     1.5    cmd.Parse (argc, argv);
     1.6  
     1.7 -
     1.8    NodeContainer csmaNodes;
     1.9    csmaNodes.Create (2);
    1.10    NodeContainer wifiNodes;
     2.1 --- a/wns3.tex	Thu Feb 26 16:41:57 2009 +0100
     2.2 +++ b/wns3.tex	Thu Feb 26 17:10:03 2009 +0100
     2.3 @@ -1,4 +1,5 @@
     2.4  \documentclass{beamer}
     2.5 +\usepackage{beamertexpower}
     2.6  \usetheme{Madrid}
     2.7  \title{}
     2.8  \author{Mathieu Lacage}
     2.9 @@ -31,9 +32,40 @@
    2.10  \tableofcontents[subsectionstyle=hide]
    2.11  \end{frame}
    2.12  
    2.13 -\section{The Example Scenario}
    2.14 +\section{How a simulation is built}
    2.15  
    2.16 -\begin{frame}{Wifi and Csma}
    2.17 +\begin{frame}{A Typical Workflow}
    2.18 +\begin{itemize}
    2.19 +\item Write a C++ \code{main} function
    2.20 +\item Drop file in \code{scratch} directory
    2.21 +\item Build with \code{./waf}
    2.22 +\item Enter run environment with \code{./waf --shell}
    2.23 +\item Execute program \code{build/debug/scratch/test}
    2.24 +\item Analyze pcap or ascii traces (wireshark)
    2.25 +\end{itemize}
    2.26 +\end{frame}
    2.27 +
    2.28 +\begin{frame}{The ns-3 API}
    2.29 +There are two ways to interact with the ns-3 API:
    2.30 +\begin{itemize}
    2.31 +\item Construct a simulation with the \emph{Container} API:
    2.32 +\begin{itemize}
    2.33 +\item Apply the same operations on sets of objects
    2.34 +\item Easy to build topologies with repeating patterns
    2.35 +\end{itemize}
    2.36 +\item Construct a simulation with the \emph{low-level} API:
    2.37 +\begin{itemize}
    2.38 +\item Instanciate every object separately, set its attributes,
    2.39 +connect it to other objects.
    2.40 +\item Very flexible but potentially complex to use
    2.41 +\end{itemize}
    2.42 +\end{itemize}
    2.43 +The best way to understand how they work and relate to each other
    2.44 +is to use both on the same example
    2.45 +\end{frame}
    2.46 +
    2.47 +
    2.48 +\begin{frame}{The testcase}
    2.49  \begin{columns}
    2.50  \begin{column}{0.5\textwidth}
    2.51  \includegraphics[width=6cm]{scenario}
    2.52 @@ -51,21 +83,9 @@
    2.53  \end{columns}
    2.54  \end{frame}
    2.55  
    2.56 -\section{The Helper Version}
    2.57 +\section{The Container Version}
    2.58  
    2.59 -\begin{frame}{Basic concepts}
    2.60 -\begin{itemize}
    2.61 -\item Work on sets of similar objects:
    2.62 -\begin{itemize}
    2.63 -\item NodeContainer
    2.64 -\item NetDeviceContainer
    2.65 -\item ...
    2.66 -\end{itemize}
    2.67 -\end{itemize}
    2.68 -\end{frame}
    2.69 -
    2.70 -\subsection{Read Command-Line Arguments}
    2.71 -\begin{frame}[fragile]{Read Command-Line Arguments}
    2.72 +\begin{frame}[fragile]{Create Nodes}
    2.73  \begin{verbatim}
    2.74  using namespace ns3;
    2.75  
    2.76 @@ -73,15 +93,30 @@
    2.77  {
    2.78    CommandLine cmd;
    2.79    cmd.Parse (argc, argv);
    2.80 -...
    2.81 +
    2.82 +  NodeContainer csmaNodes;
    2.83 +  csmaNodes.Create (2);
    2.84 +  NodeContainer wifiNodes;
    2.85 +  wifiNodes.Add (csmaNodes.Get (1));
    2.86 +  wifiNodes.Create (3);
    2.87  \end{verbatim}
    2.88  \end{frame}
    2.89  
    2.90 -\subsection{The Csma MAC link}
    2.91 +\begin{frame}[fragile]{Create the MAC Network}
    2.92 +\begin{verbatim}
    2.93 +NetDeviceContainer csmaDevices;
    2.94 +CsmaHelper csma;
    2.95 +csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps"));
    2.96 +csma.SetChannelAttribute ("Delay", StringValue ("2ms"));
    2.97 +csmaDevices = csma.Install (csmaNodes);
    2.98  
    2.99 -\begin{frame}[fragile]{The Csma MAC link}
   2.100 -\begin{verbatim}
   2.101 -
   2.102 +NetDeviceContainer wifiDevices;
   2.103 +YansWifiChannelHelper wifiChannel = 
   2.104 +  YansWifiChannelHelper::Default ();
   2.105 +YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
   2.106 +wifiPhy.SetChannel (wifiChannel.Create ());
   2.107 +WifiHelper wifi = WifiHelper::Default ();
   2.108 +wifiDevices = wifi.Install (wifiPhy, wifiNodes);
   2.109  \end{verbatim}
   2.110  \end{frame}
   2.111