21 #include "ns3/core-module.h"
22 #include "ns3/network-module.h"
23 #include "ns3/applications-module.h"
24 #include "ns3/mobility-module.h"
25 #include "ns3/stats-module.h"
26 #include "ns3/wifi-module.h"
97 while ((packet = socket->
Recv ()))
106 TypeId tid = TypeId::LookupByName (
"ns3::PacketSocketFactory");
107 Ptr<Socket> sink = Socket::CreateSocket (node, tid);
133 positionAlloc->
Add (
Vector (0.0, 0.0, 0.0));
134 positionAlloc->
Add (
Vector (5.0, 0.0, 0.0));
150 apps.
Start (Seconds (0.5));
151 apps.
Stop (Seconds (250.0));
158 Simulator::Destroy ();
163 int main (
int argc,
char *argv[])
170 cmd.
Parse (argc, argv);
182 wifiMac.
SetType (
"ns3::AdhocWifiMac");
188 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
195 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
202 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
209 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
216 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
223 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
230 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
237 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
243 gnuplot =
Gnuplot (
"rate-control.png");
250 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
256 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
262 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
268 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
274 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
280 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
Helper class for UAN CW MAC example.
holds a vector of ns3::Application pointers.
double x
x coordinate of vector
void experiment(bool enableCtsRts)
Run single 10 seconds experiment with enabled or disabled RTS/CTS mechanism.
uint32_t m_bytesTotal
Total bytes received.
Vector GetPosition(Ptr< Node > node)
static void AdvancePosition(Ptr< Node > node)
Class to represent a 2D points plot.
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 stored in this container at a given index.
Make it easy to create and manage PHY objects for the yans model.
static Vector GetPosition(Ptr< Node > node)
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())
an address for a packet socket
void ReceivePacket(Ptr< Socket > socket)
uint32_t GetSize(void) const
Vector GetPosition(void) const
void AddDataset(const GnuplotDataset &dataset)
NS_LOG_COMPONENT_DEFINE("Main")
helps to create WifiNetDevice objects
void ReceivePacket(Ptr< Socket > socket)
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)
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
a polymophic address class
Class for representing data rates.
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.
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
Hold an unsigned integer type.
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility)
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
void Add(double x, double y)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
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.
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
void SetDefault(std::string name, const AttributeValue &value)
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
OFDM PHY for the 5 GHz band (Clause 17)
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
void SetPhysicalAddress(const Address address)
keep track of a set of node pointers.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void SetMobilityModel(std::string type, 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())
Gnuplot2dDataset m_output
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 SetStyle(enum Style style)
void SetPosition(const Vector &position)
Helper class used to assign positions and mobility models to nodes.
int main(int argc, char *argv[])
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
#define NS_LOG_DEBUG(msg)
void SetProtocol(uint16_t protocol)
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.
static void SetPosition(Ptr< Node > node, Vector position)
void AdvancePosition(Ptr< Node > node)
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
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...
void SetPosition(Ptr< Node > node, Vector position)
a unique identifier for an interface.
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.