115 // enable rts cts all the time. |
115 // enable rts cts all the time. |
116 Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0")); |
116 Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0")); |
117 // disable fragmentation |
117 // disable fragmentation |
118 Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200")); |
118 Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200")); |
119 |
119 |
120 WifiHelper wifi; |
120 WifiHelper wifi = WifiHelper::Default (); |
121 MobilityHelper mobility; |
121 MobilityHelper mobility; |
122 NodeContainer stas; |
122 NodeContainer stas; |
123 NodeContainer ap; |
123 NodeContainer ap; |
124 NetDeviceContainer staDevs; |
124 NetDeviceContainer staDevs; |
125 PacketSocketHelper packetSocket; |
125 PacketSocketHelper packetSocket; |
129 |
129 |
130 // give packet socket powers to nodes. |
130 // give packet socket powers to nodes. |
131 packetSocket.Install (stas); |
131 packetSocket.Install (stas); |
132 packetSocket.Install (ap); |
132 packetSocket.Install (ap); |
133 |
133 |
134 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> (); |
134 YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
135 channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ()); |
135 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); |
136 Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> (); |
136 wifiPhy.SetChannel (wifiChannel.Create ()); |
137 channel->SetPropagationLossModel (log); |
|
138 |
|
139 Ssid ssid = Ssid ("wifi-default"); |
137 Ssid ssid = Ssid ("wifi-default"); |
140 wifi.SetRemoteStationManager ("ns3::ArfWifiManager"); |
138 wifi.SetRemoteStationManager ("ns3::ArfWifiManager"); |
141 // setup stas. |
139 // setup stas. |
142 wifi.SetMac ("ns3::NqstaWifiMac", |
140 wifi.SetMac ("ns3::NqstaWifiMac", |
143 "Ssid", SsidValue (ssid), |
141 "Ssid", SsidValue (ssid), |
144 "ActiveProbing", BooleanValue (false)); |
142 "ActiveProbing", BooleanValue (false)); |
145 staDevs = wifi.Install (stas, channel); |
143 staDevs = wifi.Install (wifiPhy, stas); |
146 // setup ap. |
144 // setup ap. |
147 wifi.SetMac ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), |
145 wifi.SetMac ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), |
148 "BeaconGeneration", BooleanValue (true), |
146 "BeaconGeneration", BooleanValue (true), |
149 "BeaconInterval", TimeValue (Seconds (2.5))); |
147 "BeaconInterval", TimeValue (Seconds (2.5))); |
150 wifi.Install (ap, channel); |
148 wifi.Install (wifiPhy, ap); |
151 |
149 |
152 // mobility. |
150 // mobility. |
153 mobility.Install (stas); |
151 mobility.Install (stas); |
154 mobility.Install (ap); |
152 mobility.Install (ap); |
155 |
153 |