View | Details | Raw Unified | Return to bug 2471
Collapse All | Expand All

(-)a/examples/wireless/ht-wifi-network.cc (-8 / +23 lines)
 Lines 39-46    Link Here 
39
//    |     |
39
//    |     |
40
//   n1     n2
40
//   n1     n2
41
//
41
//
42
//Packets in this simulation aren't marked with a QosTag so they are considered
42
// By default, packets are sent on best effort access class (AC_BE), but 
43
//belonging to BestEffort Access Class (AC_BE).
43
// when UDP is selected, a different User Priority can be set to select
44
// a different access category (e.g. User Priority 7 corresponds to AC_VO)
44
45
45
using namespace ns3;
46
using namespace ns3;
46
47
 Lines 52-63    Link Here 
52
  double simulationTime = 10; //seconds
53
  double simulationTime = 10; //seconds
53
  double distance = 1.0; //meters
54
  double distance = 1.0; //meters
54
  double frequency = 5.0; //whether 2.4 or 5.0 GHz
55
  double frequency = 5.0; //whether 2.4 or 5.0 GHz
56
  uint16_t userPriority = 0;  // AC_BE
57
  int mcs = -1; // -1 indicates an unset value
55
  
58
  
56
  CommandLine cmd;
59
  CommandLine cmd;
57
  cmd.AddValue ("frequency", "Whether working in the 2.4 or 5.0 GHz band (other values gets rejected)", frequency);
60
  cmd.AddValue ("frequency", "Whether working in the 2.4 or 5.0 GHz band (other values gets rejected)", frequency);
58
  cmd.AddValue ("distance", "Distance in meters between the station and the access point", distance);
61
  cmd.AddValue ("distance", "Distance in meters between the station and the access point", distance);
59
  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
62
  cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
60
  cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
63
  cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
64
  cmd.AddValue ("userPriority", "UserPriority for WiFi QoS", userPriority);
65
  cmd.AddValue ("mcs", "if set, limit testing to a specific MCS (0-7)", mcs);
61
  cmd.Parse (argc,argv);
66
  cmd.Parse (argc,argv);
62
67
63
  double prevThroughput [8];
68
  double prevThroughput [8];
 Lines 66-72    Link Here 
66
      prevThroughput[l] = 0;
71
      prevThroughput[l] = 0;
67
    }
72
    }
68
  std::cout << "MCS value" << "\t\t" << "Channel width" << "\t\t" << "short GI" << "\t\t" << "Throughput" << '\n';
73
  std::cout << "MCS value" << "\t\t" << "Channel width" << "\t\t" << "short GI" << "\t\t" << "Throughput" << '\n';
69
  for (int mcs = 0; mcs <= 7; mcs++)
74
  int minMcs = 0;
75
  int maxMcs = 7;
76
  if (mcs >= 0 && mcs <=7)
77
    {
78
      minMcs = mcs;
79
      maxMcs = mcs;
80
    }
81
     
82
  for (int mcsIndex = minMcs; mcsIndex <= maxMcs; mcsIndex++)
70
    {
83
    {
71
      uint8_t index = 0;
84
      uint8_t index = 0;
72
      double previous = 0;
85
      double previous = 0;
 Lines 115-121    Link Here 
115
                }
128
                }
116
129
117
              std::ostringstream oss;
130
              std::ostringstream oss;
118
              oss << "HtMcs" << mcs;
131
              oss << "HtMcs" << mcsIndex;
119
              wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", StringValue (oss.str ()),
132
              wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", StringValue (oss.str ()),
120
                                            "ControlMode", StringValue (oss.str ()));
133
                                            "ControlMode", StringValue (oss.str ()));
121
                
134
                
 Lines 172-179    Link Here 
172
                  serverApp = myServer.Install (wifiStaNode.Get (0));
185
                  serverApp = myServer.Install (wifiStaNode.Get (0));
173
                  serverApp.Start (Seconds (0.0));
186
                  serverApp.Start (Seconds (0.0));
174
                  serverApp.Stop (Seconds (simulationTime + 1));
187
                  serverApp.Stop (Seconds (simulationTime + 1));
188
                  InetSocketAddress destAddress (staNodeInterface.GetAddress (0), 9);
189
                  destAddress.SetTos (userPriority);
175
190
176
                  UdpClientHelper myClient (staNodeInterface.GetAddress (0), 9);
191
                  UdpClientHelper myClient (destAddress);
177
                  myClient.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
192
                  myClient.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
178
                  myClient.SetAttribute ("Interval", TimeValue (Time ("0.00001"))); //packets/s
193
                  myClient.SetAttribute ("Interval", TimeValue (Time ("0.00001"))); //packets/s
179
                  myClient.SetAttribute ("PacketSize", UintegerValue (payloadSize));
194
                  myClient.SetAttribute ("PacketSize", UintegerValue (payloadSize));
 Lines 223-231    Link Here 
223
                  rxBytes = payloadSize * DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
238
                  rxBytes = payloadSize * DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
224
                }
239
                }
225
              double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); //Mbit/s
240
              double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); //Mbit/s
226
              std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << sgi << "\t\t\t" << throughput << " Mbit/s" << std::endl;
241
              std::cout << mcsIndex << "\t\t\t" << channelWidth << " MHz\t\t\t" << sgi << "\t\t\t" << throughput << " Mbit/s" << std::endl;
227
              //test first element
242
              //test first element
228
              if (udp && mcs == 0 && channelWidth == 20 && sgi == 0)
243
              if (udp && mcsIndex == 0 && channelWidth == 20 && sgi == 0)
229
                {
244
                {
230
                  if (throughput < 5.25 || throughput > 6.25)
245
                  if (throughput < 5.25 || throughput > 6.25)
231
                    {
246
                    {
 Lines 234-240    Link Here 
234
                    }
249
                    }
235
                }
250
                }
236
              //test last element
251
              //test last element
237
              if (udp && mcs == 7 && channelWidth == 40 && sgi == 1)
252
              if (udp && mcsIndex == 7 && channelWidth == 40 && sgi == 1)
238
                {
253
                {
239
                  if (throughput < 133 || throughput > 135)
254
                  if (throughput < 133 || throughput > 135)
240
                    {
255
                    {

Return to bug 2471