Ns3 Projects for B.E/B.Tech M.E/M.Tech PhD Scholars.  Phone-Number:9688312542   E-mail:ns3simulation@gmail.com


An ad hoc network refers to a network connection established for a single session and does not require a router or a wireless base station.Basically, an ad hoc network is a temporary network connection created for a specific purpose (such as transferring data from one computer to another). For simulating Ad Hoc Network, we use NS3 for its scalability,self-configuring and flexible feature.

Advantages of ADHOC network:

  • Flexible ad hoc can be temporarily setup at anytime, in any place.
  • Separation from central network administration
  • Nodes in ad hoc network need not rely on any hardware and software. So, it can be connected and communicated quickly
  • Self-configuring nodes are also routers
  • Lower getting-started costs due to decentralized administration
  • Scalability incorporates the addition of more nodes
  • Self-healing through continuous re-configuration
  • Mobility allows ad hoc networks created on the fly in any situation where there are multiple wireless devices.

Challenges faced on ad hoc network:

  • Economic incentives to encourage efficient sharing of resources.
  • Naming and addressing flexibility.
  • Sensor network features like aggregation, content routing and in-networking processing.
  • Location services that provide information on geographic position.
  • Self-organization and discovery for distributed control of network topology.
  • Decentralized management for remote monitoring and control.

Applications of ad hoc network:

  • Emergency services.
  • Commercial purpose.
  • Conferencing.
  • Personal area network etc.

Sample code for NS3 ad hoc network Projects:

SpectrumChannelHelper channelHelper = SpectrumChannelHelper::Default ();
Ptr<SpectrumChannel> channel = channelHelper.Create ();
WifiSpectrumValue5MhzFactory sf;
double txPower = 0.1; // Watts
uint32_t channelNumber = 1;
Ptr<SpectrumValue> txPsd = sf.CreateTxPowerSpectralDensity (txPower, channelNumber);
// for the noise, we use the Power Spectral Density of thermal noise
// at room temperature. The value of the PSD will be constant over the band of interest.
const double k = 1.381e-23; //Boltzmann's constant
const double T = 290; // temperature in Kelvin
double noisePsdValue = k * T; // watts per hertz
Ptr<SpectrumValue> noisePsd = sf.CreateConstant (noisePsdValue);
AdhocAlohaNoackIdealPhyHelper deviceHelper;
deviceHelper.SetChannel (channel);
deviceHelper.SetTxPowerSpectralDensity (txPsd);
deviceHelper.SetNoisePowerSpectralDensity (noisePsd);
deviceHelper.SetPhyAttribute ("Rate", DataRateValue (DataRate ("1Mbps")));
NetDeviceContainer devices = deviceHelper.Install (c);
PacketSocketHelper packetSocket;
packetSocket.Install (c);
PacketSocketAddress socket;
socket.SetSingleDevice (devices.Get (0)->GetIfIndex ());
socket.SetPhysicalAddress (devices.Get (1)->GetAddress ());
socket.SetProtocol (1);
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
onoff.SetConstantRate (DataRate ("0.5Mbps"));
onoff.SetAttribute ("PacketSize", UintegerValue (125));
ApplicationContainer apps = onoff.Install (c.Get (0));
apps.Start (Seconds (0.1));
apps.Stop (Seconds (0.104));
Ptr<Socket> recvSink = SetupPacketReceive (c.Get (1));
Simulator::Stop (Seconds (10.0));
Config::Connect ("/NodeList/*/DeviceList/*/Phy/TxStart", MakeCallback (&PhyTxStartTrace));
Config::Connect ("/NodeList/*/DeviceList/*/Phy/TxEnd", MakeCallback (&PhyTxEndTrace));
Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxStart", MakeCallback (&PhyRxStartTrace));
Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxEndOk", MakeCallback (&PhyRxEndOkTrace));
Config::Connect ("/NodeList/*/DeviceList/*/Phy/RxEndError", MakeCallback (&PhyRxEndErrorTrace));