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

What is CSMA Module in Ns3

              The CSMA model in network simulator is considered as the fundamental model based on the Ethernet like network. It is assistive for the carrier sense functions and permits the multiple accesses to share the medium.

Simulation Code Using CSMA

              Here, we have highlighted some sample simulation codes using CDMA along with its functions in the following.

  • Router configuration
Ptr multicastRouter = c.Get (2);
Ptr inputIf = nd0.Get (2);
NetDeviceContainer outputDevices;
outputDevices.Add (nd1.Get (0));
multicast.AddMulticastRoute (multicastRouter, multicastSource, multicastGroup, inputIf, outputDevices);
Ptr sender = c.Get (0);
Ptr senderIf = nd0.Get (0);
multicast.SetDefaultMulticastRoute (sender, senderIf);
  • CSMA based node configuration
NS_LOG_INFO ("Build Topology.");
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
NetDeviceContainer nd0 = csma.Install (c0);
NetDeviceContainer nd1 = csma.Install (c1);
  • Include header file
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/applications-module.h"
#include "ns3/internet-module.h"

Execute CSMA Code in Ns3

              Following that, we can implement the CSMA code in ns3 type and that commands are implemented in the terminal and the results are demonstrated below.

cd /home/research/ns-allinone-3.28/ns-3.28
sudo ./waf --run CSMASimulationCode --vis
Implementation of CSMA code in ns3

            Then, we have highlighted the result that is acquired through the implementation of the above mentioned commands.

Acquired Results of CSMA code

              We are all set to provide the appropriate research guidance for the scholars for reach us and aid more.