examples/wireless/ht-wifi-network.cc
changeset 11640 8dfcbf71cb06
parent 11628 243b71de25a0
child 11642 d5269b583f2a
equal deleted inserted replaced
11639:b3b5505b8dc4 11640:8dfcbf71cb06
    85 
    85 
    86               WifiHelper wifi = WifiHelper::Default ();
    86               WifiHelper wifi = WifiHelper::Default ();
    87               wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
    87               wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
    88               HtWifiMacHelper mac = HtWifiMacHelper::Default ();
    88               HtWifiMacHelper mac = HtWifiMacHelper::Default ();
    89 
    89 
    90               Ssid ssid = Ssid ("ns380211n");
    90               StringValue DataRate = HtWifiMacHelper::DataRateForMcs (i);
    91 
       
    92               std::stringstream sstmp;
       
    93               std::string strtmp, dataRate;
       
    94               StringValue DataRate;
       
    95 
       
    96               sstmp << i;
       
    97               sstmp >> strtmp;
       
    98               dataRate = "HtMcs" + strtmp;
       
    99               DataRate = StringValue (dataRate);
       
   100 
       
   101               wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
    91               wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
   102                                             "ControlMode", DataRate);
    92                                             "ControlMode", DataRate);
       
    93                 
       
    94               Ssid ssid = Ssid ("ns3-80211n");
       
    95 
   103               mac.SetType ("ns3::StaWifiMac",
    96               mac.SetType ("ns3::StaWifiMac",
   104                            "Ssid", SsidValue (ssid),
    97                            "Ssid", SsidValue (ssid),
   105                            "ActiveProbing", BooleanValue (false));
    98                            "ActiveProbing", BooleanValue (false));
   106 
    99 
   107               NetDeviceContainer staDevice;
   100               NetDeviceContainer staDevice;
   204                 {
   197                 {
   205                   //TCP
   198                   //TCP
   206                   uint32_t totalPacketsThrough = DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
   199                   uint32_t totalPacketsThrough = DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
   207                   throughput = totalPacketsThrough * 8 / (simulationTime * 1000000.0); //Mbit/s
   200                   throughput = totalPacketsThrough * 8 / (simulationTime * 1000000.0); //Mbit/s
   208                 }
   201                 }
   209               std::cout << dataRate << "\t\t\t" << j << " MHz\t\t\t" << k << "\t\t\t" << throughput << " Mbit/s" << std::endl;
   202               std::cout << i << "\t\t\t" << j << " MHz\t\t\t" << k << "\t\t\t" << throughput << " Mbit/s" << std::endl;
   210             }
   203             }
   211           j *= 2;
   204           j *= 2;
   212         }
   205         }
   213     }
   206     }
   214   return 0;
   207   return 0;