9#include "ns3/athstats-helper.h"
10#include "ns3/boolean.h"
11#include "ns3/command-line.h"
12#include "ns3/config.h"
13#include "ns3/mobility-helper.h"
14#include "ns3/mobility-model.h"
15#include "ns3/on-off-helper.h"
16#include "ns3/packet-socket-address.h"
17#include "ns3/packet-socket-helper.h"
19#include "ns3/string.h"
20#include "ns3/yans-wifi-channel.h"
21#include "ns3/yans-wifi-helper.h"
39 std::cout <<
" TX p: " << *p << std::endl;
54 std::cout <<
" RX p: " << *p << std::endl;
76 std::cout <<
"PHYRXOK mode=" << mode <<
" snr=" << snr <<
" " << *packet << std::endl;
92 std::cout <<
"PHYRXERROR snr=" << snr <<
" " << *packet << std::endl;
114 std::cout <<
"PHYTX mode=" << mode <<
" " << *packet << std::endl;
131 std::cout <<
" state=" << state <<
" start=" << start <<
" duration=" << duration
145 Vector pos = mobility->GetPosition();
151 mobility->SetPosition(pos);
157main(
int argc,
char* argv[])
160 cmd.AddValue(
"verbose",
"Print trace information if true",
g_verbose);
161 cmd.Parse(argc, argv);
185 wifiMac.
SetType(
"ns3::StaWifiMac",
190 staDevs =
wifi.Install(wifiPhy, wifiMac, stas);
193 wifi.Install(wifiPhy, wifiMac, ap);
a polymophic address class
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
create AthstatsWifiTraceSink instances and connect them to wifi devices
void EnableAthstats(std::string filename, uint32_t nodeid, uint32_t deviceid)
Enable athstats.
Parse command-line arguments.
Class for representing data rates.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
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.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
static void EnablePrinting()
Enable printing packets metadata.
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
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 EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
The IEEE 802.11 SSID Information Element.
Simulation virtual time values and global simulation resolution.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
represent a single transmission mode
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Ptr< YansWifiChannel > Create() const
Make it easy to create and manage PHY objects for the YANS model.
void SetChannel(Ptr< YansWifiChannel > channel)
void Connect(std::string path, const CallbackBase &cb)
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
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...
void PhyRxErrorTrace(std::string context, Ptr< const Packet > packet, double snr)
PHY-level RX error trace.
void PhyStateTrace(std::string context, Time start, Time duration, WifiPhyState state)
PHY state trace.
void PhyRxOkTrace(std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)
PHY-level RX OK trace.
void PhyTxTrace(std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
PHY-level TX trace.
static bool g_verbose
True for verbose output.
void DevTxTrace(std::string context, Ptr< const Packet > p)
MAC-level TX trace.
static void AdvancePosition(Ptr< Node > node)
Move a node position by 5m on the x axis every second, up to 210m.
void DevRxTrace(std::string context, Ptr< const Packet > p)
MAC-level RX trace.