|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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;
holds a vector of ns3::NetDevice pointers
@ WIFI_STANDARD_80211n_5GHZ
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
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.
Parse command-line arguments.
void Set(std::string path, const AttributeValue &value)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
AttributeValue implementation for Boolean.
Ptr< WifiPhy > GetPhy(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
helps to create WifiNetDevice objects
@ WIFI_STANDARD_80211ax_2_4GHZ
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
@ WIFI_STANDARD_80211ax_5GHZ
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
uint8_t GetChannelNumber(void) const
Return current channel number.
uint16_t GetFrequency(void) const
bool IsSet(void) const
Return true if a valid channel has been set, false otherwise.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
AttributeValue implementation for Ssid.
The IEEE 802.11 SSID Information Element.
Hold together all Wifi-related objects.
Introspection did not find any typical Config paths.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
@ WIFI_STANDARD_80211ax_6GHZ
Hold variables of type string.
Ptr< YansWifiPhy > GetYansWifiPhyPtr(const NetDeviceContainer &nc)
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
AttributeValue implementation for Time.
uint16_t GetChannelWidth(void) const
keep track of a set of node pointers.
void SetType(std::string type, Args &&... args)
void PrintAttributesIfEnabled(bool enabled)
Hold an unsigned integer type.
manage and create wifi channel objects for the YANS model.
void ConfigureAttributes(void)
Configure the attribute values.
create MAC layers for a ns3::WifiNetDevice.
void SetDefault(std::string name, const AttributeValue &value)
@ WIFI_STANDARD_80211n_2_4GHZ
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
void SetOperatingChannel(uint8_t number, uint16_t frequency, uint16_t width)
Set the operating channel according to the specified parameters.