51 #include "ns3/core-module.h"
52 #include "ns3/network-module.h"
53 #include "ns3/applications-module.h"
54 #include "ns3/mobility-module.h"
55 #include "ns3/stats-module.h"
56 #include "ns3/random-variable-stream.h"
57 #include "ns3/wifi-module.h"
58 #include "ns3/internet-module.h"
59 #include "ns3/flow-monitor-helper.h"
60 #include "ns3/olsr-helper.h"
61 #include "ns3/ipv4-static-routing-helper.h"
62 #include "ns3/ipv4-list-routing-helper.h"
80 bool CommandSetup (
int argc,
char **argv);
81 bool IsRouting () {
return (enableRouting == 1) ? 1 : 0; }
82 bool IsMobility () {
return (enableMobility == 1) ? 1 : 0; }
99 void CheckThroughput ();
141 enableTracing (true),
142 enableFlowMon (false),
143 enableRouting (false),
144 enableMobility (false),
145 rtsThreshold (
"2200"),
146 rateManager (
"ns3::MinstrelWifiManager"),
147 outputFileName (
"minstrel")
155 TypeId tid = TypeId::LookupByName (
"ns3::UdpSocketFactory");
156 Ptr<Socket> sink = Socket::CreateSocket (node, tid);
168 while ((packet = socket->
Recv ()))
194 uint32_t totalNodes = c.
GetN ();
195 for (uint32_t i=0; i< totalNodes; i++)
197 if ( (i %
gridSize) <= (gridSize/2 - 1))
200 if ( i < totalNodes/2 )
206 if ( i >= (uint32_t)(4*totalNodes)/10 )
211 if ( (i % gridSize) >= (gridSize/2 - 1))
214 if ( i < totalNodes/2 )
220 if ( i >= (uint32_t)(4*totalNodes)/10 )
236 uint32_t limit = senderId + 2;
237 for (uint32_t i= senderId - 2; i <= limit; i++)
257 uint32_t totalNodes = c.
GetN ();
265 for (uint32_t i=0; i < totalNodes/3; i++)
294 for (uint32_t i=0; i < c.
GetN (); i++)
300 destIndex = (uint32_t) uv->
GetValue ();
301 }
while ( (c.
Get (destIndex))->GetId () == sender->
GetId ());
321 static inline std::string
333 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
336 std::ostringstream oss;
337 oss <<
"Set up Server Device " << (server->
GetDevice (0))->GetAddress ()
338 <<
" with ip " << ipv4AddrServer
339 <<
" position (" << serverPos.
x <<
"," << serverPos.
y <<
"," << serverPos.
z <<
")";
341 oss <<
"Set up Client Device " << (client->
GetDevice (0))->GetAddress ()
342 <<
" with ip " << ipv4AddrClient
343 <<
" position (" << clientPos.
x <<
"," << clientPos.
y <<
"," << clientPos.
z <<
")"
354 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
365 apps.
Start (Seconds (start));
366 apps.
Stop (Seconds (stop));
396 list.
Add (staticRouting, 0);
410 address.
SetBase (
"10.0.0.0",
"255.255.255.0");
413 ipInterfaces = address.
Assign (devices);
431 "Speed",
StringValue (
"ns3::ConstantRandomVariable[Constant=10]"),
432 "Pause",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.2]"));
447 for (uint32_t i = 0; i < nodeSize - 1; i = i+2)
527 Simulator::Destroy ();
557 cmd.
Parse (argc, argv);
561 int main (
int argc,
char *argv[])
586 wifiMac.
SetType (
"ns3::AdhocWifiMac",
598 dataset = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel, mobility);