22 #include "ns3/core-module.h"
23 #include "ns3/network-module.h"
24 #include "ns3/applications-module.h"
25 #include "ns3/mobility-module.h"
26 #include "ns3/config-store-module.h"
27 #include "ns3/wifi-module.h"
28 #include "ns3/athstats-helper.h"
41 std::cout <<
" TX p: " << *p << std::endl;
49 std::cout <<
" RX p: " << *p << std::endl;
57 std::cout <<
"PHYRXOK mode=" << mode <<
" snr=" << snr <<
" " << *packet << std::endl;
65 std::cout <<
"PHYRXERROR snr=" << snr <<
" " << *packet << std::endl;
73 std::cout <<
"PHYTX mode=" << mode <<
" " << *packet << std::endl;
81 std::cout <<
" state=" << state <<
" start=" << start <<
" duration=" << duration << std::endl;
117 int main (
int argc,
char *argv[])
122 cmd.
Parse (argc, argv);
152 wifiMac.
SetType (
"ns3::StaWifiMac",
155 staDevs = wifi.
Install (wifiPhy, wifiMac, stas);
157 wifiMac.
SetType (
"ns3::ApWifiMac",
159 wifi.
Install (wifiPhy, wifiMac, ap);
169 socket.SetPhysicalAddress (staDevs.
Get (1)->GetAddress ());
170 socket.SetProtocol (1);
176 apps.
Start (Seconds (0.5));
177 apps.
Stop (Seconds (43.0));
holds a vector of ns3::Application pointers.
double x
x coordinate of vector
keep track of time values and allow control of global simulation resolution
static void AdvancePosition(Ptr< Node > node)
Ptr< YansWifiChannel > Create(void) const
void SetRemoteStationManager(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())
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
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.
State
The state of the PHY layer.
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())
void DevTxTrace(std::string context, Ptr< const Packet > p)
an address for a packet socket
static void Run(void)
Run the simulation until one of:
Vector GetPosition(void) const
void PhyStateTrace(std::string context, Time start, Time duration, enum WifiPhy::State state)
void PhyRxErrorTrace(std::string context, Ptr< const Packet > packet, double snr)
static YansWifiPhyHelper Default(void)
Create a phy helper in a default working state.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
void Connect(std::string path, const CallbackBase &cb)
helps to create WifiNetDevice objects
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
static Vector GetPosition(Ptr< Node > node)
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Give ns3::PacketSocket powers to ns3::Node.
void SetSingleDevice(uint32_t device)
static void SetPosition(Ptr< Node > node, Vector position)
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
a polymophic address class
Class for representing data rates.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Keep track of the current position and velocity of an object.
void SetChannel(Ptr< YansWifiChannel > channel)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
static void EnablePrinting(void)
By default, packets do not keep around enough metadata to perform the operations requested by the Pri...
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void PhyRxOkTrace(std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, enum WifiPreamble preamble)
static NqosWifiMacHelper Default(void)
Create a mac helper in a default working state.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
create non QoS-enabled MAC layers for a ns3::WifiNetDevice.
Parse command-line arguments.
static void Destroy(void)
Every event scheduled by the Simulator::insertAtDestroy method is invoked.
void DevRxTrace(std::string context, Ptr< const Packet > p)
void SetDefault(std::string name, const AttributeValue &value)
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
keep track of a set of node pointers.
void PhyTxTrace(std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
create AthstatsWifiTraceSink instances and connect them to wifi devices
manage and create wifi channel objects for the yans model.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
void SetPosition(const Vector &position)
void EnableAthstats(std::string filename, uint32_t nodeid, uint32_t deviceid)
The IEEE 802.11 SSID Information Element.
Helper class used to assign positions and mobility models to nodes.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
int main(int argc, char *argv[])
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
static void Stop(void)
If an event invokes this method, it will be the last event scheduled by the Simulator::run method bef...
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
hold objects of type ns3::Ssid
void Parse(int argc, char *argv[])
Parse the program arguments.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< T > GetObject(void) const
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
static WifiHelper Default(void)