78#include "ns3/ap-wifi-mac.h"
79#include "ns3/application-container.h"
80#include "ns3/command-line.h"
81#include "ns3/config.h"
82#include "ns3/double.h"
83#include "ns3/he-configuration.h"
84#include "ns3/he-phy.h"
85#include "ns3/mobility-helper.h"
86#include "ns3/multi-model-spectrum-channel.h"
87#include "ns3/obss-pd-algorithm.h"
88#include "ns3/packet-socket-client.h"
89#include "ns3/packet-socket-helper.h"
90#include "ns3/packet-socket-server.h"
91#include "ns3/spectrum-wifi-helper.h"
93#include "ns3/string.h"
94#include "ns3/wifi-net-device.h"
105 std::string sub = context.substr(10);
107 return std::stoi(sub.substr(0, pos));
132 else if (context ==
"2")
148 Time duration{
"10s"};
161 int channelWidth{20};
164 Time interval{
"1ms"};
169 cmd.AddValue(
"duration",
"Duration of simulation", duration);
170 cmd.AddValue(
"interval",
"Inter packet interval", interval);
172 cmd.AddValue(
"d1",
"Distance between STA1 and AP1 (m)",
d1);
173 cmd.AddValue(
"d2",
"Distance between STA2 and AP2 (m)",
d2);
174 cmd.AddValue(
"d3",
"Distance between AP1 and AP2 (m)",
d3);
175 cmd.AddValue(
"powSta1",
"Power of STA1 (dBm)",
powSta1);
176 cmd.AddValue(
"powSta2",
"Power of STA2 (dBm)",
powSta2);
177 cmd.AddValue(
"powAp1",
"Power of AP1 (dBm)",
powAp1);
178 cmd.AddValue(
"powAp2",
"Power of AP2 (dBm)",
powAp2);
179 cmd.AddValue(
"ccaEdTrSta1",
"CCA-ED Threshold of STA1 (dBm)",
ccaEdTrSta1);
180 cmd.AddValue(
"ccaEdTrSta2",
"CCA-ED Threshold of STA2 (dBm)",
ccaEdTrSta2);
181 cmd.AddValue(
"ccaEdTrAp1",
"CCA-ED Threshold of AP1 (dBm)",
ccaEdTrAp1);
182 cmd.AddValue(
"ccaEdTrAp2",
"CCA-ED Threshold of AP2 (dBm)",
ccaEdTrAp2);
183 cmd.AddValue(
"minimumRssi",
184 "Minimum RSSI for the ThresholdPreambleDetectionModel",
186 cmd.AddValue(
"channelWidth",
"Bandwidth of the channel in MHz [20, 40, or 80]", channelWidth);
187 cmd.AddValue(
"obssPdThreshold",
"Threshold for the OBSS PD Algorithm",
obssPdThreshold);
188 cmd.AddValue(
"mcs",
"The constant MCS value to transmit HE PPDUs", mcs);
191 g_resetFile1.open(
"wifi-spatial-reuse-resets-bss-1.txt", std::ofstream::out);
192 g_resetFile2.open(
"wifi-spatial-reuse-resets-bss-2.txt", std::ofstream::out);
209 spectrumPhy.SetErrorRateModel(
"ns3::YansErrorRateModel");
210 switch (channelWidth)
222 NS_ABORT_MSG(
"Unrecognized channel width: " << channelWidth);
225 spectrumPhy.SetPreambleDetectionModel(
"ns3::ThresholdPreambleDetectionModel",
233 wifi.SetObssPdAlgorithm(
"ns3::ConstantObssPdAlgorithm",
239 std::ostringstream
oss;
240 oss <<
"HeMcs" << mcs;
241 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
301 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
345 Config::Connect(
"/NodeList/*/ApplicationList/*/$ns3::PacketSocketServer/Rx",
368 std::cout <<
"Throughput for BSS " <<
i + 1 <<
": " <<
throughput <<
" Mbit/s" << std::endl;
a polymophic address class
holds a vector of ns3::Application pointers.
Parse command-line arguments.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
an address for a packet socket
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
Ptr< HeConfiguration > GetHeConfiguration() const
Hold together all Wifi-related objects.
Ptr< WifiMac > GetMac() const
void Connect(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
uint32_t bytesReceived
Counter of the received bytes.
uint32_t ContextToNodeId(std::string context)
std::ofstream g_resetFile2
void ResetTrace(std::string context, uint8_t bssColor, double rssiDbm, bool powerRestricted, double txPowerMaxDbmSiso, double txPowerMaxDbmMimo)
std::ofstream g_resetFile1
void SocketRx(std::string context, Ptr< const Packet > p, const Address &addr)