27 #include "ns3/command-line.h"
28 #include "ns3/config-store.h"
29 #include "ns3/config.h"
30 #include "ns3/boolean.h"
31 #include "ns3/uinteger.h"
32 #include "ns3/string.h"
34 #include "ns3/yans-wifi-phy.h"
35 #include "ns3/yans-wifi-helper.h"
36 #include "ns3/wifi-net-device.h"
60 int main (
int argc,
char *argv[])
62 uint32_t testCase = 0;
63 bool printAttributes =
false;
64 bool exceptionThrown =
false;
67 cmd.AddValue (
"testCase",
"Test case", testCase);
68 cmd.AddValue (
"printAttributes",
"If true, print out attributes", printAttributes);
69 cmd.Parse (argc, argv);
80 wifi.SetRemoteStationManager (
"ns3::IdealWifiManager");
84 ssid =
Ssid (
"wifi-phy-configuration");
86 macSta.
SetType (
"ns3::StaWifiMac",
90 macAp.
SetType (
"ns3::ApWifiMac",
105 phySta = CreateObject<YansWifiPhy> ();
116 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
127 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
138 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
149 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
160 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
171 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
182 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
193 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
204 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
216 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
228 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
240 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
252 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
256 Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber",
UintegerValue (40));
257 Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber",
UintegerValue (40));
267 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
271 Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber",
UintegerValue (46));
272 Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber",
UintegerValue (46));
281 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
285 Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber",
UintegerValue (46));
286 Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber",
UintegerValue (46));
296 exceptionThrown =
false;
299 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
301 catch (
const std::runtime_error&)
303 exceptionThrown =
true;
306 exceptionThrown =
false;
311 catch (
const std::runtime_error&)
313 exceptionThrown =
true;
323 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
335 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
338 exceptionThrown =
false;
343 catch (
const std::runtime_error&)
345 exceptionThrown =
true;
353 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
356 exceptionThrown =
false;
361 catch (
const std::runtime_error&)
363 exceptionThrown =
true;
372 exceptionThrown =
false;
377 catch (
const std::runtime_error&)
379 exceptionThrown =
true;
394 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
402 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
423 exceptionThrown =
false;
428 catch (
const std::runtime_error&)
430 exceptionThrown =
true;
439 exceptionThrown =
false;
444 catch (
const std::runtime_error&)
446 exceptionThrown =
true;
456 std::cerr <<
"Invalid testcase number " << testCase << std::endl;
AttributeValue implementation for Boolean.
Parse command-line arguments.
Introspection did not find any typical Config paths.
void ConfigureAttributes(void)
Configure the attribute values.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
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.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
Hold variables of type string.
AttributeValue implementation for Time.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
Hold together all Wifi-related objects.
Ptr< WifiPhy > GetPhy(void) const
uint8_t GetChannelNumber(void) const
Return current channel number.
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
void SetOperatingChannel(uint8_t number, uint16_t frequency, uint16_t width)
Set the operating channel according to the specified parameters.
uint16_t GetChannelWidth(void) const
uint16_t GetFrequency(void) const
bool IsSet(void) const
Return true if a valid channel has been set, false otherwise.
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state.
Make it easy to create and manage PHY objects for the YANS model.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void SetDefault(std::string name, const AttributeValue &value)
void Set(std::string path, const AttributeValue &value)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
@ WIFI_STANDARD_80211n_5GHZ
@ WIFI_STANDARD_80211ax_5GHZ
@ WIFI_STANDARD_80211n_2_4GHZ
@ WIFI_STANDARD_80211ax_2_4GHZ
@ WIFI_STANDARD_80211ax_6GHZ
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< YansWifiPhy > GetYansWifiPhyPtr(const NetDeviceContainer &nc)
void PrintAttributesIfEnabled(bool enabled)