From 4b0f97c0aa3b34ea1692124e1ecb07c5ed5031db Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Tue, 9 Dec 2008 12:04:36 -0800 Subject: [PATCH] Add reasonable data rate and delay to csma channels; update tutorial --- doc/tutorial/building-topologies.texi | 20 ++++++++++++++++---- examples/second.cc | 2 ++ examples/third.cc | 2 ++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/tutorial/building-topologies.texi b/doc/tutorial/building-topologies.texi index 90db50d6c..a50260881 100644 --- a/doc/tutorial/building-topologies.texi +++ b/doc/tutorial/building-topologies.texi @@ -163,10 +163,19 @@ point-to-point nodes. We mentioned above that you were going to see a helper for CSMA devices and channels, and the next lines introduce them. The @code{CsmaHelper} works just like a @code{PointToPointHelper}, but it creates and connects CSMA devices and -channels. +channels. In the case of a CSMA device and channel pair, notice that the data +rate is specified by a @em{channel} attribute instead of a device attribute. +This is because a real CSMA network does not allow one to mix, for example, +10Base-T and 100Base-T devices on a given channel. We first set the data rate +to 100 megabits per second, and then set the speed-of-light delay of the channel +to 6560 nano-seconds (arbitrarily chosen as 1 nanosecond per foot over a 100 +meter segment). Notice that you can set an attribute using its native data +type. @verbatim CsmaHelper csma; + csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps")); + csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560))); NetDeviceContainer csmaDevices; csmaDevices = csma.Install (csmaNodes); @@ -698,12 +707,15 @@ that will get CSMA devices. The node in question is going to end up with a point-to-point device and a CSMA device. We then create a number of ``extra'' nodes that compose the remainder of the CSMA network. -We then instantiate a @code{CsmaHelper} and a @code{NetDeviceContainer} to -keep track of the CSMA net devices. Then we @code{Install} CSMA devices on -the selected nodes. +We then instantiate a @code{CsmaHelper} and set its attributes as we did in +the previous example. We create a @code{NetDeviceContainer} to keep track of +the created CSMA net devices and then we @code{Install} CSMA devices on the +selected nodes. @verbatim CsmaHelper csma; + csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps")); + csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560))); NetDeviceContainer csmaDevices; csmaDevices = csma.Install (csmaNodes); diff --git a/examples/second.cc b/examples/second.cc index 791b8a9d1..a568a999f 100644 --- a/examples/second.cc +++ b/examples/second.cc @@ -59,6 +59,8 @@ main (int argc, char *argv[]) p2pDevices = pointToPoint.Install (p2pNodes); CsmaHelper csma; + csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps")); + csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560))); NetDeviceContainer csmaDevices; csmaDevices = csma.Install (csmaNodes); diff --git a/examples/third.cc b/examples/third.cc index 3fb9b5b8d..bbb526a0c 100644 --- a/examples/third.cc +++ b/examples/third.cc @@ -65,6 +65,8 @@ main (int argc, char *argv[]) csmaNodes.Create (nCsma); CsmaHelper csma; + csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps")); + csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560))); NetDeviceContainer csmaDevices; csmaDevices = csma.Install (csmaNodes);