9#include "ns3/command-line.h" 
   10#include "ns3/config.h" 
   11#include "ns3/gnuplot.h" 
   12#include "ns3/ipv4-address-helper.h" 
   14#include "ns3/mobility-helper.h" 
   15#include "ns3/mobility-model.h" 
   16#include "ns3/on-off-helper.h" 
   17#include "ns3/packet-socket-address.h" 
   18#include "ns3/packet-socket-helper.h" 
   19#include "ns3/string.h" 
   20#include "ns3/uinteger.h" 
   21#include "ns3/yans-wifi-channel.h" 
   22#include "ns3/yans-wifi-helper.h" 
  104    mobility->SetPosition(position);
 
 
  111    return mobility->GetPosition();
 
 
  134    while ((packet = socket->Recv()))
 
 
  165    phy.SetChannel(wifiChannel.
Create());
 
  171    positionAlloc->Add(Vector(0.0, 0.0, 0.0));
 
  172    positionAlloc->Add(Vector(5.0, 0.0, 0.0));
 
  173    mobility.SetPositionAllocator(positionAlloc);
 
  174    mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
 
  184    onoff.SetConstantRate(
DataRate(60000000));
 
 
  202main(
int argc, 
char* argv[])
 
  205    cmd.Parse(argc, argv);
 
  217    wifiMac.
SetType(
"ns3::AdhocWifiMac");
 
  221    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  224    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  229    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  232    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  237    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  240    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  245    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  248    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  253    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  256    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  261    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  264    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  269    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  272    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  277    wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
 
  280    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  285    gnuplot = 
Gnuplot(
"rate-control.png");
 
  289    wifi.SetRemoteStationManager(
"ns3::ArfWifiManager");
 
  290    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  295    wifi.SetRemoteStationManager(
"ns3::AarfWifiManager");
 
  296    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  301    wifi.SetRemoteStationManager(
"ns3::AarfcdWifiManager");
 
  302    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  307    wifi.SetRemoteStationManager(
"ns3::CaraWifiManager");
 
  308    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  313    wifi.SetRemoteStationManager(
"ns3::RraaWifiManager");
 
  314    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
  319    wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
 
  320    dataset = 
experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel);
 
WiFi adhoc experiment class.
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
Run an experiment.
uint32_t m_bytesTotal
The number of received bytes.
void ReceivePacket(Ptr< Socket > socket)
Receive a packet.
void SetPosition(Ptr< Node > node, Vector position)
Set the position of a node.
void AdvancePosition(Ptr< Node > node)
Move a node by 1m on the x axis, stops at 210m.
Gnuplot2dDataset m_output
The output dataset.
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Setup the receiving socket.
Vector GetPosition(Ptr< Node > node)
Get the position of a node.
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.
Parse command-line arguments.
Class for representing data rates.
Class to represent a 2D points plot.
void SetStyle(Style style)
void Add(double x, double y)
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
void AddDataset(const GnuplotDataset &dataset)
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
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
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.
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 Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Hold variables of type string.
a unique identifier for an interface.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
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 experiment(std::string queue_disc_type)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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...
Ptr< PacketSink > sink
Pointer to the packet sink application.