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;
66 cmd.AddValue (
"testCase",
"Test case", testCase);
67 cmd.AddValue (
"printAttributes",
"If true, print out attributes", printAttributes);
68 cmd.Parse (argc, argv);
79 wifi.SetRemoteStationManager (
"ns3::IdealWifiManager");
83 ssid =
Ssid (
"wifi-phy-configuration");
85 macSta.
SetType (
"ns3::StaWifiMac",
89 macAp.
SetType (
"ns3::ApWifiMac",
104 phySta = CreateObject<YansWifiPhy> ();
118 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
129 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
140 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
151 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
162 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
173 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
184 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
195 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
206 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
218 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
230 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
241 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
253 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
265 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
269 Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber",
UintegerValue (40));
270 Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber",
UintegerValue (40));
280 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
284 Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelWidth",
UintegerValue (40));
285 Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelWidth",
UintegerValue (40));
296 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
300 Config::Set (
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelWidth",
UintegerValue (40));
301 Config::Set (
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelWidth",
UintegerValue (40));
314 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
328 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
340 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
352 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
379 staDevice =
wifi.Install (
phy, macSta, wifiStaNode.
Get (0));
415 std::cerr <<
"Invalid testcase number " << testCase << std::endl;
Introspection did not find any typical Config paths.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
AttributeValue implementation for Boolean.
Hold variables of type string.
Make it easy to create and manage PHY objects for the YANS model.
static YansWifiChannelHelper Default(void)
Create a channel helper in a default working state.
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...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void PrintAttributesIfEnabled(bool enabled)
helps to create WifiNetDevice objects
uint16_t GetChannelWidth(void) const
AttributeValue implementation for Time.
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
Hold together all Wifi-related objects.
Parse command-line arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Ptr< WifiPhy > GetPhy(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
uint16_t GetFrequency(void) const
802.11 PHY layer modelThis PHY implements a model of 802.11a.
Ptr< YansWifiPhy > GetYansWifiPhyPtr(const NetDeviceContainer &nc)
manage and create wifi channel objects for the YANS model.
uint8_t GetChannelNumber(void) const
Return current channel number.
create MAC layers for a ns3::WifiNetDevice.
The IEEE 802.11 SSID Information Element.
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
void ConfigureAttributes(void)
Configure the attribute values.
AttributeValue implementation for Ssid.
void SetDefault(std::string name, const AttributeValue &value)
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
bool DefineChannelNumber(uint8_t channelNumber, WifiPhyBand band, WifiPhyStandard standard, uint16_t frequency, uint16_t channelWidth)
Add a channel definition to the WifiPhy.