examples/tutorial/third.cc
changeset 6674 52f8688d6d01
parent 6673 ec22aa763e2d
child 6821 203367ae7433
equal deleted inserted replaced
6673:ec22aa763e2d 6674:52f8688d6d01
    23 #include "ns3/ipv4-global-routing-helper.h"
    23 #include "ns3/ipv4-global-routing-helper.h"
    24 
    24 
    25 // Default Network Topology
    25 // Default Network Topology
    26 //
    26 //
    27 //   Wifi 10.1.3.0
    27 //   Wifi 10.1.3.0
    28 //                 AP   
    28 //                 AP
    29 //  *    *    *    *
    29 //  *    *    *    *
    30 //  |    |    |    |    10.1.1.0
    30 //  |    |    |    |    10.1.1.0
    31 // n5   n6   n7   n0 -------------- n1   n2   n3   n4
    31 // n5   n6   n7   n0 -------------- n1   n2   n3   n4
    32 //                   point-to-point  |    |    |    |
    32 //                   point-to-point  |    |    |    |
    33 //                                   ================
    33 //                                   ================
    88 
    88 
    89   WifiHelper wifi = WifiHelper::Default ();
    89   WifiHelper wifi = WifiHelper::Default ();
    90   wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
    90   wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
    91 
    91 
    92   NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
    92   NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
    93   
    93 
    94   Ssid ssid = Ssid ("ns-3-ssid");
    94   Ssid ssid = Ssid ("ns-3-ssid");
    95   mac.SetType ("ns3::StaWifiMac",
    95   mac.SetType ("ns3::StaWifiMac",
    96                "Ssid", SsidValue (ssid),
    96                "Ssid", SsidValue (ssid),
    97                "ActiveProbing", BooleanValue (false));
    97                "ActiveProbing", BooleanValue (false));
    98 
    98 
   106   apDevices = wifi.Install (phy, mac, wifiApNode);
   106   apDevices = wifi.Install (phy, mac, wifiApNode);
   107 
   107 
   108   MobilityHelper mobility;
   108   MobilityHelper mobility;
   109 
   109 
   110   mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
   110   mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
   111     "MinX", DoubleValue (0.0),
   111                                  "MinX", DoubleValue (0.0),
   112     "MinY", DoubleValue (0.0),
   112                                  "MinY", DoubleValue (0.0),
   113     "DeltaX", DoubleValue (5.0),
   113                                  "DeltaX", DoubleValue (5.0),
   114     "DeltaY", DoubleValue (10.0),
   114                                  "DeltaY", DoubleValue (10.0),
   115     "GridWidth", UintegerValue (3),
   115                                  "GridWidth", UintegerValue (3),
   116     "LayoutType", StringValue ("RowFirst"));
   116                                  "LayoutType", StringValue ("RowFirst"));
   117 
   117 
   118   mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
   118   mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
   119     "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
   119                              "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
   120   mobility.Install (wifiStaNodes);
   120   mobility.Install (wifiStaNodes);
   121 
   121 
   122   mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
   122   mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
   123   mobility.Install (wifiApNode);
   123   mobility.Install (wifiApNode);
   124 
   124