21 #include "ns3/core-module.h"
22 #include "ns3/network-module.h"
23 #include "ns3/mobility-module.h"
24 #include "ns3/stats-module.h"
25 #include "ns3/wifi-module.h"
26 #include "ns3/internet-module.h"
50 uint32_t pktCount,
Time pktInterval );
84 while ((packet = socket->
Recv ()))
93 TypeId tid = TypeId::LookupByName (
"ns3::UdpSocketFactory");
94 Ptr<Socket> sink = Socket::CreateSocket (node, tid);
103 uint32_t pktCount,
Time pktInterval )
107 socket->
Send (Create<Packet> (pktSize));
109 socket, pktSize,pktCount-1, pktInterval);
137 positionAlloc->
Add (
Vector (0.0, 0.0, 0.0));
138 positionAlloc->
Add (
Vector (5.0, 0.0, 0.0));
145 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.0");
150 TypeId tid = TypeId::LookupByName (
"ns3::UdpSocketFactory");
156 uint32_t maxPacketCount = 200;
157 Time interPacketInterval = Seconds (1.);
159 this, source, packetSize, maxPacketCount,interPacketInterval);
162 Simulator::Destroy ();
167 int main (
int argc,
char *argv[])
169 std::ofstream outfile (
"clear-channel.plt");
170 std::vector <std::string> modes;
172 modes.push_back (
"DsssRate1Mbps");
173 modes.push_back (
"DsssRate2Mbps");
174 modes.push_back (
"DsssRate5_5Mbps");
175 modes.push_back (
"DsssRate11Mbps");
181 cmd.
Parse (argc, argv);
185 for (uint32_t i = 0; i < modes.size (); i++)
187 std::cout << modes[i] << std::endl;
190 for (
double rss = -102.0; rss <= -80.0; rss += 0.5)
193 dataset.
SetStyle (Gnuplot2dDataset::LINES);
203 wifiMac.
SetType (
"ns3::AdhocWifiMac");
219 uint32_t pktsRecvd = experiment.
Run (wifi, wifiPhy, wifiMac, wifiChannel);
220 dataset.
Add (rss, pktsRecvd);
225 gnuplot.
SetTerminal (
"postscript eps color enh \"Times-BoldItalic\"");
226 gnuplot.
SetLegend (
"RSS(dBm)",
"Number of packets received");
227 gnuplot.
SetExtra (
"set xrange [-102:-83]");