40 #include "ns3/core-module.h"
41 #include "ns3/network-module.h"
42 #include "ns3/netanim-module.h"
43 #include "ns3/mobility-module.h"
44 #include "ns3/applications-module.h"
81 double avgThroughput = 0.0;
82 for (uint32_t i=0; i<
m_avgs; i++)
91 SeedManager::SetRun (SeedManager::GetRun () + 1);
93 NS_LOG_DEBUG (
"Average for cw=" << cw <<
" over " <<
m_avgs <<
" runs: " << avgThroughput);
104 for (; it !=
nodes.End (); it++)
116 while ((packet = socket->
Recv ()))
136 #ifdef UAN_PROP_BH_INSTALLED
169 <<
" min. range " << minr);
171 mobility.SetPositionAllocator (pos);
172 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
198 for (uint32_t an = 0; an <
m_avgs; an++)
209 TypeId psfid = TypeId::LookupByName (
"ns3::PacketSocketFactory");
215 Ptr<Socket> sinkSocket = Socket::CreateSocket (sinkNode, psfid);
216 sinkSocket->
Bind (socket);
221 std::string traceFileName =
"uan-animation.xml";
230 for (uint32_t i=0; i < nc.
GetN (); i++)
234 for (uint32_t i=0; i <
sink.GetN (); i++)
239 for (uint32_t i=0; i <
devices.GetN (); i++)
243 for (uint32_t i=0; i < sinkdev.
GetN (); i++)
248 Simulator::Destroy ();
253 main (
int argc,
char **argv)
261 std::string perModel =
"ns3::UanPhyPerGenDefault";
262 std::string sinrModel =
"ns3::UanPhyCalcSinrDefault";
265 cmd.AddValue (
"NumNodes",
"Number of transmitting nodes", exp.
m_numNodes);
266 cmd.AddValue (
"Depth",
"Depth of transmitting and sink nodes", exp.
m_depth);
267 cmd.AddValue (
"RegionSize",
"Size of boundary in meters", exp.
m_boundary);
268 cmd.AddValue (
"PacketSize",
"Generated packet size in bytes", exp.
m_packetSize);
269 cmd.AddValue (
"DataRate",
"DataRate in bps", exp.
m_dataRate);
270 cmd.AddValue (
"CwMin",
"Min CW to simulate", exp.
m_cwMin);
271 cmd.AddValue (
"CwMax",
"Max CW to simulate", exp.
m_cwMax);
272 cmd.AddValue (
"SlotTime",
"Slot time duration", exp.
m_slotTime);
273 cmd.AddValue (
"Averages",
"Number of topologies to test for each cw point", exp.
m_avgs);
274 cmd.AddValue (
"PerModel",
"PER model name", perModel);
275 cmd.AddValue (
"SinrModel",
"SINR model name", sinrModel);
276 cmd.Parse (argc, argv);
286 mode = UanTxModeFactory::CreateMode (UanTxMode::FSK, exp.
m_dataRate,
293 uan.SetPhy (
"ns3::UanPhyGen",
Helper class for UAN CW MAC example.
void IncrementCw(uint32_t cw)
Increment CW function.
double m_boundary
boundary
std::vector< double > m_throughputs
throughputs
uint32_t m_cwMin
CW minimum.
uint32_t m_cwMax
CW maximum.
void Run(UanHelper &uan)
Run function.
Time m_simTime
simulation time
uint32_t m_dataRate
data rate
uint32_t m_numNodes
number of nodes
uint32_t m_packetSize
packet size
void ReceivePacket(Ptr< Socket > socket)
Receive packet function.
void ResetData()
Reset data function.
NetAnimExperiment()
the experiment
void UpdatePositions(NodeContainer &nodes)
Update positions function.
uint32_t m_bytesTotal
bytes total
uint32_t m_cwStep
CW step.
a polymophic address class
Interface to network animator.
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Parse command-line arguments.
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
void SetPosition(const Vector &position)
Vector GetPosition(void) const
holds a vector of ns3::NetDevice pointers
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
virtual Address GetAddress(void) const =0
virtual uint32_t GetIfIndex(void) const =0
keep track of a set of node pointers.
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Instantiate subclasses of ns3::Object.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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.
Hold objects of type Ptr<T>.
Object to create transport layer instances that provide a socket API to applications.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
a unique identifier for an interface.
UAN configuration helper.
void SetMac(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())
Set MAC attributes.
NetDeviceContainer Install(NodeContainer c) const
This method creates a simple ns3::UanChannel (with a default ns3::UanNoiseModelDefault and ns3::UanPr...
Container for UanTxModes.
void AppendMode(UanTxMode mode)
Add mode to this list.
AttributeValue implementation for UanModesList.
Class used for calculating SINR of packet in UanPhy.
Calculate packet error probability, based on received SINR and modulation (mode).
Abstraction of packet modulation information.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void Set(std::string path, const AttributeValue &value)
#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.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ LOG_LEVEL_ALL
Print everything.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
list x
Random number samples.