1.1 --- a/Makefile Sun Apr 05 21:44:11 2009 +0200
1.2 +++ b/Makefile Mon Apr 06 16:38:52 2009 +0200
1.3 @@ -15,8 +15,10 @@
1.4 simulation-workflow.dia \
1.5 architecture.dia \
1.6 scenario.dia \
1.7 -topology-basics \
1.8 -device-channel
1.9 +topology-basics.dia \
1.10 +device-channel.dia \
1.11 +WifiArchitecture.dia \
1.12 +internet-stack.dia
1.13 PDF_SOURCES=test-random-variable.pdf
1.14 PNG_SOURCES=ns-3-doxygen.png
1.15
2.1 Binary file WifiArchitecture.dia has changed
3.1 Binary file internet-stack.dia has changed
4.1 --- a/tutorial-helper.cc Sun Apr 05 21:44:11 2009 +0200
4.2 +++ b/tutorial-helper.cc Mon Apr 06 16:38:52 2009 +0200
4.3 @@ -38,7 +38,7 @@
4.4 "X", StringValue ("100.0"),
4.5 "Y", StringValue ("100.0"),
4.6 "Rho", StringValue ("Uniform:0:30"));
4.7 - mobility.SetMobilityModel ("ns3::StaticMobilityModel");
4.8 + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
4.9 mobility.Install (wifiNodes);
4.10
4.11 Ipv4InterfaceContainer csmaInterfaces;
5.1 --- a/tutorial-lowlevel.cc Sun Apr 05 21:44:11 2009 +0200
5.2 +++ b/tutorial-lowlevel.cc Mon Apr 06 16:38:52 2009 +0200
5.3 @@ -68,7 +68,7 @@
5.4 static void
5.5 AddMobility (Ptr<Node> node)
5.6 {
5.7 - Ptr<StaticMobilityModel> mobility = CreateObject<StaticMobilityModel> ();
5.8 + Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
5.9 mobility->SetPosition (GetPositionAllocator ()->GetNext ());
5.10 node->AggregateObject (mobility);
5.11 }
6.1 --- a/tutorial.tex Sun Apr 05 21:44:11 2009 +0200
6.2 +++ b/tutorial.tex Mon Apr 06 16:38:52 2009 +0200
6.3 @@ -293,6 +293,487 @@
6.4 \end{itemize}
6.5 \end{frame}
6.6
6.7 +\begin{frame}{Existing model implementations}
6.8 +
6.9 +\begin{itemize}
6.10 +\item Network stacks: ipv4, icmpv4, udp, tcp (ipv6 under review)
6.11 +\item Devices: wifi, csma, point-to-point, bridge
6.12 +\item Error models and queues
6.13 +\item Applications: udp echo, on/off, sink
6.14 +\item Mobility models: random walk, etc.
6.15 +\item Routing: olsr, static global
6.16 +\end{itemize}
6.17 +
6.18 +\end{frame}
6.19 +
6.20 +\begin{frame}[fragile,allowframebreaks]{The helper/container API}
6.21 +
6.22 +We want to:
6.23 +\begin{itemize}
6.24 +\item Make it easy to build topologies with repeating patterns
6.25 +\item Make the topology description more high-level (and less verbose)
6.26 +to make it easier to read and understand
6.27 +\end{itemize}
6.28 +The idea is simple:
6.29 +\begin{itemize}
6.30 +\item Sets of objects are stored in \code{Container}s
6.31 +\item One operation is encoded in a \code{Helper} object
6.32 +and applies on a \code{Container}
6.33 +\end{itemize}
6.34 +
6.35 +Helper operations:
6.36 +\begin{itemize}
6.37 +\item Are not generic: different helpers provide different operations
6.38 +\item Do not try to allow code reuse: just try to minimize the amount of code written
6.39 +\item Provide \emph{syntactical sugar}: make the code easier to read
6.40 +\end{itemize}
6.41 +
6.42 +\break
6.43 +
6.44 +Example containers:
6.45 +\begin{itemize}
6.46 +\item \code{NodeContainer}
6.47 +\item \code{NetDeviceContainer}
6.48 +\item \code{Ipv4AddressContainer}
6.49 +\end{itemize}
6.50 +
6.51 +Example helper classes:
6.52 +\begin{itemize}
6.53 +\item \code{InternetStackHelper}
6.54 +\item \code{WifiHelper}
6.55 +\item \code{MobilityHelper}
6.56 +\item \code{OlsrHelper}
6.57 +\item etc. Each model provides a helper class
6.58 +\end{itemize}
6.59 +
6.60 +\break
6.61 +
6.62 +
6.63 +For example, we create a couple of nodes:
6.64 +{\footnotesize
6.65 +\begin{columns}
6.66 +\begin{column}[c]{0.5\textwidth}
6.67 +\begin{block}{}
6.68 +\begin{verbatim}
6.69 +NodeContainer csmaNodes;
6.70 +csmaNodes.Create (2);
6.71 +NodeContainer wifiNodes;
6.72 +wifiNodes.Add (csmaNodes.Get (1));
6.73 +wifiNodes.Create (3);
6.74 +\end{verbatim}
6.75 +\end{block}
6.76 +\end{column}
6.77 +\begin{column}[c]{0.4\textwidth}
6.78 +\begin{block}{}
6.79 +Create empty node container \\
6.80 +Create two nodes \\
6.81 +Create empty node container \\
6.82 +Add existing node to it \\
6.83 +And then create some more nodes \\
6.84 +\end{block}
6.85 +\end{column}
6.86 +\end{columns}}
6.87 +\hspace{1cm}\\
6.88 +And, then, we create the csma network:
6.89 +{\footnotesize
6.90 +\begin{columns}[t]
6.91 +\begin{column}{0.55\textwidth}
6.92 +\begin{block}{}
6.93 +\begin{verbatim}
6.94 +NetDeviceContainer csmaDevices;
6.95 +CsmaHelper csma;
6.96 +csma.SetChannelAttribute ("DataRate",
6.97 + StringValue ("5Mbps"));
6.98 +csma.SetChannelAttribute ("Delay",
6.99 + StringValue ("2ms"));
6.100 +csmaDevices = csma.Install (csmaNodes);
6.101 +\end{verbatim}
6.102 +\end{block}
6.103 +\end{column}
6.104 +\begin{column}{0.4\textwidth}
6.105 +\begin{block}{}
6.106 +Create empty device container \\
6.107 +Create csma helper \\
6.108 +Set data rate \\
6.109 +\hspace{1cm}\\
6.110 +Set delay \\
6.111 +\hspace{1cm}\\
6.112 +Create csma devices and channel \\
6.113 +\end{block}
6.114 +\end{column}
6.115 +\end{columns}}
6.116 +
6.117 +\break
6.118 +
6.119 +Finally, setup the wifi channel:
6.120 +{\footnotesize
6.121 +\begin{block}{}
6.122 +\begin{verbatim}
6.123 +YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
6.124 +YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
6.125 +wifiPhy.SetChannel (wifiChannel.Create ());
6.126 +\end{verbatim}
6.127 +\end{block}
6.128 +}
6.129 +
6.130 +And create adhoc devices on this channel:
6.131 +{\footnotesize
6.132 +\begin{block}{}
6.133 +\begin{verbatim}
6.134 +NetDeviceContainer wifiDevices;
6.135 +WifiHelper wifi = WifiHelper::Default ();
6.136 +wifiDevices = wifi.Install (wifiPhy, wifiNodes);
6.137 +\end{verbatim}
6.138 +\end{block}
6.139 +}
6.140 +
6.141 +\end{frame}
6.142 +
6.143 +\begin{frame}{The wifi models}
6.144 +
6.145 +\begin{itemize}
6.146 +\item New model, written from 802.11 specification
6.147 +\item Accurate model of the MAC
6.148 +\item DCF, beacon generation, probing, association
6.149 +\item A set of rate control algorithms (ARF, ideal, AARF, etc.)
6.150 +\item Not-so-slow models of the 802.11a PHY
6.151 +\end{itemize}
6.152 +\end{frame}
6.153 +
6.154 +\begin{frame}{Development of wifi models}
6.155 +
6.156 +New contributions from many developers:
6.157 +\begin{itemize}
6.158 +\item University of Florence: 802.11n, EDCA, frame aggregation, block ack
6.159 +\item Russian Academy of Sciences: 802.11s, HWMP routing protocol
6.160 +\item Boeing: 802.11b channel models, validation
6.161 +\item Deutsche Telekom Laboratories: PHY modelization, validation
6.162 +\item Karlsruhe Institute of Technology: PHY modelization (Rayleigh, Nakagami)
6.163 +\end{itemize}
6.164 +
6.165 +\end{frame}
6.166 +
6.167 +\begin{frame}{Wifi implementation}
6.168 +
6.169 +\includegraphics[width=10cm]{WifiArchitecture}
6.170 +\end{frame}
6.171 +
6.172 +\begin{frame}[fragile,allowframebreaks]{Mobility models}
6.173 +
6.174 +Setup the initial position:
6.175 +{\footnotesize
6.176 +\begin{block}{}
6.177 +\begin{verbatim}
6.178 +MobilityHelper mobility;
6.179 +mobility.SetPositionAllocator ("ns3::RandomDiscPositionAllocator",
6.180 + "X", StringValue ("100.0"),
6.181 + "Y", StringValue ("100.0"),
6.182 + "Rho", StringValue ("Uniform:0:30"));
6.183 +\end{verbatim}
6.184 +\end{block}
6.185 +}
6.186 +
6.187 +And setup the mobility model during simulation:
6.188 +{\footnotesize
6.189 +\begin{block}{}
6.190 +\begin{verbatim}
6.191 +mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
6.192 +mobility.Install (wifiNodes);
6.193 +\end{verbatim}
6.194 +\end{block}
6.195 +}
6.196 +
6.197 +\break
6.198 +
6.199 +\begin{itemize}
6.200 +\item The \code{MobilityModel} base class:
6.201 +\begin{itemize}
6.202 +\item \code{SetPosition}, \code{GetPosition}: 3d x,y,z vector
6.203 +\item \code{GetVelocity}: 3d x,y,z vector
6.204 +\end{itemize}
6.205 +\item \code{ConstantPositionMobilityModel}: node is at a fixed location; does not move on its own
6.206 +\item \code{ConstantVelocityMobilityModel}: node moves with a fixed velocity vector
6.207 +\item \code{ConstantAccelerationMobilityModel}: node moves with a fixed acceleration vector
6.208 +\item \code{RandomWaypointMobilityModel}:
6.209 +\begin{itemize}
6.210 +\item Node pauses for a certain random time
6.211 +\item Node selects a random waypoint and speed
6.212 +\item Node starts walking towards the waypoint
6.213 +\item When waypoint is reached, goto first state
6.214 +\end{itemize}
6.215 +
6.216 +\end{itemize}
6.217 +
6.218 +\break
6.219 +
6.220 +\begin{itemize}
6.221 +\item \code{RandomDirection2dMobilityModel}
6.222 +\begin{itemize}
6.223 +\item Works inside a rectangular bounded area
6.224 +\item Node selects a random direction and speed
6.225 +\item Node walks in that direction until the edge
6.226 +\item Node pauses for random time
6.227 +\item Repeat
6.228 +\end{itemize}
6.229 +\item \code{RandomWalk2dMobilityModel}: brownian motion
6.230 +\begin{itemize}
6.231 +\item Works inside a rectangular bounded area
6.232 +\item Node selects a random direction and speed
6.233 +\item Node walks in that direction until either a fixed delay, or distance expires, or edge is hit
6.234 +\item If edge is hit, reflexive angle, same speed
6.235 +\item If fixed distance or delay expires, repeat random direction and speed
6.236 +\end{itemize}
6.237 +\item \code{HierarchicalMobilityModel}: for group mobility and complex mobility patterns
6.238 +\item \code{Ns2MobilityHelper}: for ns-2 mobility files
6.239 +\end{itemize}
6.240 +
6.241 +\end{frame}
6.242 +
6.243 +\begin{frame}[fragile,allowframebreaks]{Ipv4, Udp, Tcp models}
6.244 +
6.245 +Install the ipv4, udp, and tcp stacks:
6.246 +{\footnotesize
6.247 +\begin{block}{}
6.248 +\begin{verbatim}
6.249 +InternetStackHelper internet;
6.250 +internet.Install (NodeContainer::GetGlobal ());
6.251 +\end{verbatim}
6.252 +\end{block}
6.253 +}
6.254 +
6.255 +Assign ipv4 addresses:
6.256 +{\footnotesize
6.257 +\begin{block}{}
6.258 +\begin{verbatim}
6.259 +Ipv4InterfaceContainer csmaInterfaces;
6.260 +Ipv4InterfaceContainer wifiInterfaces;
6.261 +Ipv4AddressHelper ipv4;
6.262 +ipv4.SetBase ("10.1.1.0", "255.255.255.0");
6.263 +csmaInterfaces = ipv4.Assign (csmaDevices);
6.264 +ipv4.SetBase ("10.1.2.0", "255.255.255.0");
6.265 +wifiInterfaces = ipv4.Assign (wifiDevices);
6.266 +\end{verbatim}
6.267 +\end{block}
6.268 +}
6.269 +
6.270 +Setup routing tables:
6.271 +{\footnotesize
6.272 +\begin{block}{}
6.273 +\begin{verbatim}
6.274 +GlobalRouteManager::PopulateRoutingTables ();
6.275 +\end{verbatim}
6.276 +\end{block}
6.277 +}
6.278 +
6.279 +\break
6.280 +
6.281 +\includegraphics[width=6cm]{internet-stack}
6.282 +
6.283 +\break
6.284 +
6.285 +TCP:
6.286 +\begin{itemize}
6.287 +\item native ns-3 TCP (ported from GTNetS)
6.288 +\item Network Simulation Craddle: linux, BSD, etc.
6.289 +\end{itemize}
6.290 +
6.291 +To enable NSC:
6.292 +\begin{block}{}
6.293 +internetStack.SetNscStack ("liblinux2.6.26.so");
6.294 +\end{block}
6.295 +
6.296 +\break
6.297 +
6.298 +XXX: Need nsc slides + routing slides
6.299 +
6.300 +\end{frame}
6.301 +
6.302 +\begin{frame}[fragile,allowframebreaks]{Traffic generation and reception}
6.303 +
6.304 +Prepare to create an on-off traffic generator:
6.305 +{\footnotesize
6.306 +\begin{block}{}
6.307 +\begin{verbatim}
6.308 +OnOffHelper onoff ("ns3::UdpSocketFactory",
6.309 + InetSocketAddress ("10.1.2.2", 1025));
6.310 +onoff.SetAttribute ("OnTime", StringValue ("Constant:1.0"));
6.311 +onoff.SetAttribute ("OffTime", StringValue ("Constant:0.0"));
6.312 +\end{verbatim}
6.313 +\end{block}
6.314 +}
6.315 +Install the traffic generator:
6.316 +{\footnotesize
6.317 +\begin{block}{}
6.318 +\begin{verbatim}
6.319 +ApplicationContainer apps;
6.320 +apps = onoff.Install (csmaNodes.Get (0));
6.321 +\end{verbatim}
6.322 +\end{block}
6.323 +}
6.324 +
6.325 +and start it:
6.326 +{\footnotesize
6.327 +\begin{block}{}
6.328 +\begin{verbatim}
6.329 +apps.Start (Seconds (1.0));
6.330 +apps.Stop (Seconds (4.0));
6.331 +\end{verbatim}
6.332 +\end{block}
6.333 +}
6.334 +
6.335 +\break
6.336 +
6.337 +Setup the traffic sink:
6.338 +{\footnotesize
6.339 +\begin{block}{}
6.340 +\begin{verbatim}
6.341 +PacketSinkHelper sink ("ns3::UdpSocketFactory",
6.342 + InetSocketAddress ("10.1.2.2", 1025));
6.343 +apps = sink.Install (wifiNodes.Get (1));
6.344 +apps.Start (Seconds (0.0));
6.345 +apps.Stop (Seconds (4.0));
6.346 +\end{verbatim}
6.347 +\end{block}
6.348 +}
6.349 +
6.350 +\break
6.351 +
6.352 +Applications:
6.353 +\begin{itemize}
6.354 +\item All subclass \code{ns3::Application}
6.355 +\item Are managed by a Node
6.356 +\item Represent a process on an actual system
6.357 +\item Talk to network stacks through one or more sockets
6.358 +\end{itemize}
6.359 +
6.360 +\end{frame}
6.361 +
6.362 +\begin{frame}[fragile]{ns-3 Sockets}
6.363 +
6.364 +\begin{columns}[t]
6.365 +\begin{column}{0.45\textwidth}
6.366 +Plain C sockets:
6.367 +{\tiny
6.368 +\begin{block}{}
6.369 +\begin{verbatim}
6.370 +int sk;
6.371 +sk = socket(PF_INET, SOCK_DGRAM, 0);
6.372 +
6.373 +struct sockaddr_in src;
6.374 +inet_pton(AF_INET,"0.0.0.0",&src.sin_addr);
6.375 +src.sin_port = htons(80);
6.376 +bind(sk, (struct sockaddr *) &src,sizeof(src));
6.377 +
6.378 +struct sockaddr_in dest;
6.379 +inet_pton(AF_INET,"10.0.0.1",&dest.sin_addr);
6.380 +dest.sin_port = htons(80);
6.381 +connect(sk,(struct sockaddr *) &dest,
6.382 + sizeof(dest));
6.383 +
6.384 +send(sk, "hello", 6, 0);
6.385 +
6.386 +
6.387 +
6.388 +
6.389 +
6.390 +
6.391 +
6.392 +char buf[6];
6.393 +recv(sk, buf, 6, 0);
6.394 +\end{verbatim}
6.395 +\end{block}
6.396 +}
6.397 +\end{column}
6.398 +
6.399 +\begin{column}{0.45\textwidth}
6.400 +ns-3 sockets:
6.401 +{\tiny
6.402 +\begin{block}{}
6.403 +\begin{verbatim}
6.404 +Ptr<Socket> sk;
6.405 +sk = udpFactory->CreateSocket ();
6.406 +
6.407 +
6.408 +
6.409 +
6.410 +sk->Bind (InetSocketAddress (80));
6.411 +
6.412 +
6.413 +Ipv4Address ipv4Dst ("10.0.0.1")
6.414 +InetSocketAddress dst (ipv4Dst, 80)
6.415 +sk->Connect(dst);
6.416 +
6.417 +
6.418 +sk->Send (Create<Packet> ("hello", 6));
6.419 +
6.420 +void MySocketReceive (Ptr<Socket> sk,
6.421 + Ptr<Packet> packet)
6.422 +{
6.423 +...
6.424 +}
6.425 +sk->SetReceiveCallback (
6.426 + MakeCallback (MySocketReceive));
6.427 +[...] Simulator::Run ()
6.428 +\end{verbatim}
6.429 +\end{block}
6.430 +}
6.431 +\end{column}
6.432 +
6.433 +\end{columns}
6.434 +
6.435 +\end{frame}
6.436 +
6.437 +\begin{frame}[fragile,allowframebreaks]{Object attributes}
6.438 +
6.439 +Configure the default value of all attributes:
6.440 +{\footnotesize
6.441 +\begin{block}{}
6.442 +\begin{verbatim}
6.443 +CommandLine cmd;
6.444 +cmd.Parse (argc, argv);
6.445 +\end{verbatim}
6.446 +\end{block}
6.447 +}
6.448 +
6.449 +Setting individual attributes:
6.450 +{\footnotesize
6.451 +\begin{block}{}
6.452 +\begin{verbatim}
6.453 +onoff.SetAttribute ("OnTime", StringValue ("Constant:1.0"));
6.454 +onoff.SetAttribute ("OffTime", StringValue ("Constant:0.0"));
6.455 +\end{verbatim}
6.456 +\end{block}
6.457 +}
6.458 +
6.459 +Configure and explore all attributes:
6.460 +{\footnotesize
6.461 +\begin{block}{}
6.462 +\begin{verbatim}
6.463 +GtkConfigStore config;
6.464 +config.Configure ();
6.465 +\end{verbatim}
6.466 +\end{block}
6.467 +}
6.468 +
6.469 +\break
6.470 +
6.471 +A researcher wants to:
6.472 +\begin{itemize}
6.473 +\item Discover all the ways he can tweak his models
6.474 +\item Save for each simulation the value of all control variables
6.475 +\item Tweak all control variables
6.476 +\end{itemize}
6.477 +
6.478 +In ns-3, attributes provide a unified way to do this:
6.479 +\begin{itemize}
6.480 +\item An attribute represents a value in an object
6.481 +\item We can visualize all of them in a GUI
6.482 +\item We can dump and read them all in configuration files
6.483 +\item We can set them all from the command-line
6.484 +\item We can set them all from environment variables
6.485 +\end{itemize}
6.486 +
6.487 +\end{frame}
6.488
6.489
6.490 \end{document}