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"
63 m_slotTime (Seconds (0.2)),
64 m_simTime (Seconds (1000))
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
140 #endif //UAN_PROP_BH_INSTALLED
165 minr = std::min (minr, newr);
168 NS_LOG_DEBUG (
"Mean range from gateway: " << rsum / m_numNodes
169 <<
" min. range " << minr);
191 apps.
Start (Seconds (0.5));
192 Time nextEvent = Seconds (0.5);
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 ();
261 std::string perModel =
"ns3::UanPhyPerGenDefault";
262 std::string sinrModel =
"ns3::UanPhyCalcSinrDefault";
266 cmd.
AddValue (
"Depth",
"Depth of transmitting and sink nodes", exp.
m_depth);
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",
296 "SupportedModes", UanModesListValue (myModes));
void ReceivePacket(Ptr< Socket > socket)
holds a vector of ns3::Application pointers.
keep track of time values and allow control of global simulation resolution
std::vector< Ptr< Node > >::const_iterator Iterator
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
static Vector GetPosition(Ptr< Node > node)
an address for a packet socket
#define NS_ASSERT(condition)
void SetTypeId(TypeId tid)
uint32_t GetSize(void) const
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
Container for UanTxModes.
void UpdatePositions(NodeContainer &nodes)
void Set(std::string path, const AttributeValue &value)
Object to create transport layer instances that provide a socket API to applications.
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)
a polymophic address class
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
Keep track of the current position and velocity of an object.
double GetSeconds(void) const
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
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())
hold objects of type ns3::Time
Ptr< Object > Create(void) const
Hold an unsigned integer type.
Abstraction of packet modulation information.
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
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...
void IncrementCw(uint32_t cw)
void AggregateObject(Ptr< Object > other)
Parse command-line arguments.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
void SetPhysicalAddress(const Address address)
keep track of a set of node pointers.
hold objects of type Ptr<T>
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
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())
void Install(Ptr< Node > node) const
void SetPosition(const Vector &position)
Helper class for UAN CW MAC example.
Helper class used to assign positions and mobility models to nodes.
instantiate subclasses of ns3::Object.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
int main(int argc, char *argv[])
hold objects of type ns3::DataRate
void AddValue(const std::string &name, const std::string &help, T &value)
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
#define NS_LOG_DEBUG(msg)
void AppendMode(UanTxMode mode)
void SetProtocol(uint16_t protocol)
Interface to network animator.
void Parse(int argc, char *argv[])
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
NetDeviceContainer Install(NodeContainer c) const
Hold an floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
ApplicationContainer Install(NodeContainer c) const
a unique identifier for an interface.
std::vector< double > m_throughputs
void SetAttribute(std::string name, const AttributeValue &value)
void LogComponentEnable(char const *name, enum LogLevel level)