NS2 Wimax Example Code

Wimax Projects Using NS3 simulator

Wimax depends upon Wireless MAN technology. NS3 Wimax is a scalable wireless platform for constructing complementary and alternative broadband networks. A wireless technology optimized for the delivery of IP centric services over a wide area of networks. Download sample NS3 Wimax example code which is used to optimize IP centric service in a wide network for better service.

NS3 Wimax Example Code

Types of services offered by wimax:

  • Non-line-of-sight.
  • Line-of-sight.

Types of usage models in IEEE 802.16:

  • Fixed usage model (IEEE 802.16-2004).
  • Portable usage model (IEEE 802.16e).

Scope for introducing wimax:

  • It can help service providers meet many of challenges they face due to increasing customer demands.
  • WIMAX can satisfy potential applications like filling gaps in cable, extending broadband capabilities to bridge them closer to subscribers etc.
  • WIMAX can support very high bandwidth solutions where large spectrum deployments are desired using existing infrastructure keeping cost down.
  • WIMAX, which is an IP-based wireless broadband technology, can be integrated into both wide-area 3G mobile and wireless networks.



Download Sample NS3 WIMAX Example Code:

This is the simple NS3 WIMAX example code.
#include “ns3/core-module.h”
#include “ns3/network-module.h”
#include “ns3/applications-module.h”
#include “ns3/mobility-module.h”
#include “ns3/config-store-module.h”
#include “ns3/wimax-module.h”
#include “ns3/internet-module.h”
#include “ns3/global-route-manager.h”
#include “ns3/ipcs-classifier-record.h”
#include “ns3/service-flow.h”
using namespace ns3;
NS_LOG_COMPONENT_DEFINE (“WimaxSimpleExample”);
int main (int argc, char *argv[])
bool verbose = false;
int duration = 7, schedType = 0;
WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
CommandLine cmd;
cmd.AddValue (“scheduler”, “type of scheduler to use with the network devices”, schedType);
cmd.AddValue (“duration”, “duration of the simulation in seconds”, duration);
cmd.AddValue (“verbose”, “turn on all WimaxNetDevice log components”, verbose);
cmd.Parse (argc, argv);
LogComponentEnable (“UdpClient”, LOG_LEVEL_INFO);
LogComponentEnable (“UdpServer”, LOG_LEVEL_INFO);
switch (schedType)
case 0:
scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
case 1:
scheduler = WimaxHelper::SCHED_TYPE_MBQOS;
case 2:
scheduler = WimaxHelper::SCHED_TYPE_RTPS;
scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
NodeContainer ssNodes;
NodeContainer bsNodes;
ssNodes.Create (2);
bsNodes.Create (1);
WimaxHelper wimax;
NetDeviceContainer ssDevs, bsDevs;
ssDevs = wimax.Install (ssNodes,
bsDevs = wimax.Install (bsNodes, WimaxHelper::DEVICE_TYPE_BASE_STATION, WimaxHelper::SIMPLE_PHY_TYPE_OFDM, scheduler);
wimax.EnableAscii (“bs-devices”, bsDevs);
wimax.EnableAscii (“ss-devices”, ssDevs);
Ptr ss[2];
for (int i = 0; i < 2; i++) { ss[i] = ssDevs.Get (i)->GetObject ();
ss[i]->SetModulationType (WimaxPhy::MODULATION_TYPE_QAM16_12);
Ptr bs;
bs = bsDevs.Get (0)->GetObject ();
InternetStackHelper stack;
stack.Install (bsNodes);
stack.Install (ssNodes);
Ipv4AddressHelper address;
address.SetBase (“”, “”);
Ipv4InterfaceContainer SSinterfaces = address.Assign (ssDevs);
Ipv4InterfaceContainer BSinterface = address.Assign (bsDevs);
if (verbose)
wimax.EnableLogComponents (); // Turn on all wimax logging
UdpServerHelper udpServer;
ApplicationContainer serverApps;
UdpClientHelper udpClient;
ApplicationContainer clientApps;
udpServer = UdpServerHelper (100);
serverApps = udpServer.Install (ssNodes.Get (0));
serverApps.Start (Seconds (6));
serverApps.Stop (Seconds (duration));
udpClient = UdpClientHelper (SSinterfaces.GetAddress (0), 100);
udpClient.SetAttribute (“MaxPackets”, UintegerValue (1200));
udpClient.SetAttribute (“Interval”, TimeValue (Seconds (0.5)));
udpClient.SetAttribute (“PacketSize”, UintegerValue (1024));
clientApps = udpClient.Install (ssNodes.Get (1));
clientApps.Start (Seconds (6));
clientApps.Stop (Seconds (duration));
Simulator::Stop (Seconds (duration + 0.1));
wimax.EnablePcap (“wimax-simple-ss0”, ssNodes.Get (0)->GetId (), ss[0]->GetIfIndex ());
wimax.EnablePcap (“wimax-simple-ss1”, ssNodes.Get (1)->GetId (), ss[1]->GetIfIndex ());
wimax.EnablePcap (“wimax-simple-bs0”, bsNodes.Get (0)->GetId (), bs->GetIfIndex ());
IpcsClassifierRecord DlClassifierUgs (Ipv4Address (“”), Ipv4Mask (“”),
SSinterfaces.GetAddress (0), Ipv4Mask (“”), 0, 65000, 100, 100, 17, 1);
ServiceFlow DlServiceFlowUgs = wimax.CreateServiceFlow (ServiceFlow::SF_DIRECTION_DOWN,
IpcsClassifierRecord UlClassifierUgs (SSinterfaces.GetAddress (1), Ipv4Mask (“”), Ipv4Address (“”), Ipv4Mask (“”), 0, 65000, 100, 100, 17, 1);
ServiceFlow UlServiceFlowUgs = wimax.CreateServiceFlow (ServiceFlow::SF_DIRECTION_UP,
ServiceFlow::SF_TYPE_RTPS, UlClassifierUgs);
ss[0]->AddServiceFlow (DlServiceFlowUgs);
ss[1]->AddServiceFlow (UlServiceFlowUgs);
NS_LOG_INFO (“Starting simulation…..”);
Simulator::Run ();
ss[0] = 0;
ss[1] = 0;
bs = 0;
Simulator::Destroy ();
NS_LOG_INFO (“Done.”);
return 0;