Add reasonable data rate and delay to csma channels; update tutorial
authorCraig Dowell <craigdo@ee.washington.edu>
Tue, 09 Dec 2008 12:04:36 -0800
changeset 39959bda1a9c0eb2
parent 3994 6cc096bc0761
child 3996 2277ff80158c
Add reasonable data rate and delay to csma channels; update tutorial
doc/tutorial/building-topologies.texi
examples/second.cc
examples/third.cc
     1.1 --- a/doc/tutorial/building-topologies.texi	Tue Dec 09 10:28:44 2008 -0800
     1.2 +++ b/doc/tutorial/building-topologies.texi	Tue Dec 09 12:04:36 2008 -0800
     1.3 @@ -163,10 +163,19 @@
     1.4  We mentioned above that you were going to see a helper for CSMA devices and
     1.5  channels, and the next lines introduce them.  The @code{CsmaHelper} works just
     1.6  like a @code{PointToPointHelper}, but it creates and connects CSMA devices and
     1.7 -channels.
     1.8 +channels.  In the case of a CSMA device and channel pair, notice that the data
     1.9 +rate is specified by a @em{channel} attribute instead of a device attribute.
    1.10 +This is because a real CSMA network does not allow one to mix, for example, 
    1.11 +10Base-T and 100Base-T devices on a given channel.  We first set the data rate
    1.12 +to 100 megabits per second, and then set the speed-of-light delay of the channel
    1.13 +to 6560 nano-seconds (arbitrarily chosen as 1 nanosecond per foot over a 100
    1.14 +meter segment).  Notice that you can set an attribute using its native data 
    1.15 +type.
    1.16  
    1.17  @verbatim
    1.18    CsmaHelper csma;
    1.19 +  csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
    1.20 +  csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560)));
    1.21  
    1.22    NetDeviceContainer csmaDevices;
    1.23    csmaDevices = csma.Install (csmaNodes);
    1.24 @@ -698,12 +707,15 @@
    1.25  point-to-point device and a CSMA device.  We then create a number of ``extra''
    1.26  nodes that compose the remainder of the CSMA network.
    1.27  
    1.28 -We then instantiate a @code{CsmaHelper} and a @code{NetDeviceContainer} to 
    1.29 -keep track of the CSMA net devices.  Then we @code{Install} CSMA devices on 
    1.30 -the selected nodes.
    1.31 +We then instantiate a @code{CsmaHelper} and set its attributes as we did in
    1.32 +the previous example.  We create a @code{NetDeviceContainer} to keep track of
    1.33 +the created CSMA net devices and then we @code{Install} CSMA devices on the 
    1.34 +selected nodes.
    1.35  
    1.36  @verbatim
    1.37    CsmaHelper csma;
    1.38 +  csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
    1.39 +  csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560)));
    1.40  
    1.41    NetDeviceContainer csmaDevices;
    1.42    csmaDevices = csma.Install (csmaNodes);
     2.1 --- a/examples/second.cc	Tue Dec 09 10:28:44 2008 -0800
     2.2 +++ b/examples/second.cc	Tue Dec 09 12:04:36 2008 -0800
     2.3 @@ -59,6 +59,8 @@
     2.4    p2pDevices = pointToPoint.Install (p2pNodes);
     2.5  
     2.6    CsmaHelper csma;
     2.7 +  csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
     2.8 +  csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560)));
     2.9  
    2.10    NetDeviceContainer csmaDevices;
    2.11    csmaDevices = csma.Install (csmaNodes);
     3.1 --- a/examples/third.cc	Tue Dec 09 10:28:44 2008 -0800
     3.2 +++ b/examples/third.cc	Tue Dec 09 12:04:36 2008 -0800
     3.3 @@ -65,6 +65,8 @@
     3.4    csmaNodes.Create (nCsma);
     3.5  
     3.6    CsmaHelper csma;
     3.7 +  csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
     3.8 +  csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560)));
     3.9  
    3.10    NetDeviceContainer csmaDevices;
    3.11    csmaDevices = csma.Install (csmaNodes);