0% found this document useful (0 votes)
15 views38 pages

Wireless Communication Lab Manual

This document provides the index and experiment details for a lab manual on wireless communication. It includes 7 experiments covering topics like WiFi infrastructure and ad-hoc modes, WiFi to wired bridging, and studying GSM architecture. The first experiment listed involves connecting WiFi and CSMA nodes in a network, with the WiFi nodes and an access point using various networking attributes and mobility models.

Uploaded by

Kingsterz gaming
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views38 pages

Wireless Communication Lab Manual

This document provides the index and experiment details for a lab manual on wireless communication. It includes 7 experiments covering topics like WiFi infrastructure and ad-hoc modes, WiFi to wired bridging, and studying GSM architecture. The first experiment listed involves connecting WiFi and CSMA nodes in a network, with the WiFi nodes and an access point using various networking attributes and mobility models.

Uploaded by

Kingsterz gaming
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DEPARTMENT OF COMPUTER SCIENCE &

ENGINEERING

LAB MANUAL OF
WIRELESS COMMUNICATION LAB ETEC
463
Index

Exp. no Experiment Name Date of Date of Remarks Marks


performan checking
ce
1 WIFI TO BUS(CSMA)
CONNECTION
2 WIFI SIMPLE
INFRASTUCTURE MODE

3 WIFI SIMPLE ADHOC MODE

4 WIFI TO WIRED BRIDGING

5 WIFI TO LTE(4G)
CONNECTION
6 CREATING A SIMPLE WIFI
ADHOC GRID
7 To Study Architecture of
GSM.
1. WIFI TO BUS(CSMA) CONNECTION
// Default Network Topology
//
// Number of wifi or csma nodes can be increased up to 250
// |
// Rank 0 | Rank 1
// -------------------------|---------------------------- //
Wifi [Link]
// AP //
* * * *
// | | | | [Link]
// n5 n6 n7 n0 -------------- n1 n2 n3 n4
// point-to-point | | | |
// ================
// LAN [Link]

#include "ns3/core-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("ThirdScriptExample");

int main (int argc, char


*argv[])
{
bool verbose = true;
uint32_t nCsma = 3;
uint32_t nWifi = 3;
bool tracing = false;

CommandLine cmd;
[Link] ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
[Link] ("nWifi", "Number of wifi STA devices", nWifi); [Link]
("verbose", "Tell echo applications to log if true", verbose); [Link]
("tracing", "Enable pcap tracing", tracing);

[Link] (argc,argv);

// Check for valid number of csma or wifi nodes


// 250 should be enough, otherwise IP addresses
// soon become an issue
if (nWifi > 250 || nCsma > 250)
{
std::cout << "Too many wifi or csma nodes, no more than 250 each." << std::endl;
return 1;
}

if (verbose)
{
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
}

NodeContainer p2pNodes;
[Link] (2);

PointToPointHelper pointToPoint; [Link]


("DataRate", StringValue ("5Mbps"));
[Link] ("Delay", StringValue ("2ms"));

NetDeviceContainer p2pDevices;
p2pDevices = [Link] (p2pNodes);

NodeContainer csmaNodes;
[Link] ([Link] (1));
[Link] (nCsma);

CsmaHelper csma; [Link] ("DataRate",


StringValue ("100Mbps")); [Link] ("Delay",
TimeValue (NanoSeconds (6560)));

NetDeviceContainer csmaDevices;
csmaDevices = [Link] (csmaNodes);

NodeContainer wifiStaNodes;
[Link] (nWifi);
NodeContainer wifiApNode = [Link] (0);

YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();


YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
[Link] ([Link] ());

WifiHelper wifi;
[Link] ("ns3::AarfWifiManager");

WifiMacHelper mac;
Ssid ssid = Ssid ("ns-3-ssid");
[Link] ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));

NetDeviceContainer staDevices;
staDevices = [Link] (phy, mac, wifiStaNodes);

[Link] ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));

NetDeviceContainer apDevices;
apDevices = [Link] (phy, mac, wifiApNode);

MobilityHelper mobility;

[Link] ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (5.0),
"DeltaY", DoubleValue (10.0),
"GridWidth", UintegerValue (3),
"LayoutType", StringValue ("RowFirst"));

[Link] ("ns3::RandomWalk2dMobilityModel",
"Bounds", RectangleValue (Rectangle (-50, 50, -50, 50)));
[Link] (wifiStaNodes);

[Link] ("ns3::ConstantPositionMobilityModel");
[Link] (wifiApNode);
InternetStackHelper stack;
[Link] (csmaNodes); [Link]
(wifiApNode);
[Link] (wifiStaNodes);

Ipv4AddressHelper address;

[Link] ("[Link]", "[Link]");


Ipv4InterfaceContainer p2pInterfaces;
p2pInterfaces = [Link] (p2pDevices);

[Link] ("[Link]", "[Link]");


Ipv4InterfaceContainer csmaInterfaces;
csmaInterfaces = [Link] (csmaDevices);

[Link] ("[Link]", "[Link]");


[Link] (staDevices);
[Link] (apDevices);

UdpEchoServerHelper echoServer (9);

ApplicationContainer serverApps = [Link] ([Link] (nCsma));


[Link] (Seconds (1.0));
[Link] (Seconds (10.0));

UdpEchoClientHelper echoClient ([Link] (nCsma), 9);


[Link] ("MaxPackets", UintegerValue (1)); [Link]
("Interval", TimeValue (Seconds (1.0))); [Link] ("PacketSize",
UintegerValue (1024));

ApplicationContainer clientApps =
[Link] ([Link] (nWifi - 1));
[Link] (Seconds (2.0));
[Link] (Seconds (10.0));

Ipv4GlobalRoutingHelper::PopulateRoutingTables ();

Simulator::Stop (Seconds (10.0));

if (tracing == true)
{
[Link] ("third");
[Link] ("third", [Link] (0));
[Link] ("third", [Link] (0), true);
}

Simulator::Run ();
Simulator::Destroy ();
return 0; }

2) WIFI SIMPLE INFRASTUCTURE MODE

This script configures two nodes on an 802.11b physical layer, with 802.11b NICs in
infrastructure mode, and by default, the station sends one packet of 1000 (application) bytes to
the access point. The physical layer is configured to receive at a fixed RSS (regardless of the
distance and transmit power); therefore, changing position of the nodes has no effect.

There are a number of command-line options available to control the default behavior. The list
of available command-line options can be listed with the following command:
./waf --run "wifi-simple-infra --help" For instance, for this configuration, the physical layer
will stop successfully receiving packets when rss drops below -97 dBm. To see this effect, try
running:

./waf --run "wifi-simple-infra --rss=-97 --numPackets=20"


./waf --run "wifi-simple-infra --rss=-98 --numPackets=20"/ ./waf --run "wifi-simple-infra -rss=-
99 --numPackets=20"

Note that all ns-3 attributes (not just the ones exposed in the below script) can be changed at
command line; see the documentation.

This script can also be helpful to put the Wifi layer into verbose logging mode; this command
will turn on all wifi logging:
./waf --run "wifi-simple-infra --verbose=1"
When you are done, you will notice two pcap trace files in your directory. If you have tcpdump
installed, you can try this: tcpdump -r [Link] -nn -tt

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/config-store-module.h" #include
"ns3/wifi-module.h"
#include "ns3/internet-module.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("WifiSimpleInfra");

void ReceivePacket (Ptr<Socket> socket) {


while (socket->Recv ())
{
NS_LOG_UNCOND ("Received one packet!");
}
}

static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize,


uint32_t pktCount, Time pktInterval )
{
if (pktCount > 0)
{
socket->Send (Create<Packet> (pktSize));
Simulator::Schedule (pktInterval, &GenerateTraffic,
socket, pktSize,pktCount-1, pktInterval);
}
else
{
socket->Close ();
}
}

int main (int argc, char *argv[])


{
std::string phyMode ("DsssRate1Mbps");
double rss = -80; // -dBm uint32_t
packetSize = 1000; // bytes uint32_t
numPackets = 1; double interval = 1.0; //
seconds bool verbose = false;

CommandLine cmd;
[Link] ("phyMode", "Wifi Phy mode", phyMode); [Link]
("rss", "received signal strength", rss); [Link] ("packetSize", "size of
application packet sent", packetSize); [Link] ("numPackets", "number of
packets generated", numPackets); [Link] ("interval", "interval (seconds)
between packets", interval); [Link] ("verbose", "turn on all
WifiNetDevice log components", verbose);

[Link] (argc,
argv); // Convert to time
object
Time interPacketInterval = Seconds (interval);

// disable fragmentation for frames below 2200 bytes


Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold",
StringValue ("2200"));
// turn off RTS/CTS for frames below 2200 bytes
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue
("2200"));
// Fix non-unicast data rate to be the same as that of unicast
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
StringValue (phyMode));

NodeContainer c;
[Link] (2);

// The below set of helpers will help us to put together the wifi NICs we want
WifiHelper wifi;
if (verbose)
{
[Link] (); // Turn on all Wifi logging
}
[Link] (WIFI_PHY_STANDARD_80211b);

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();


// This is one parameter that matters when using FixedRssLossModel
// set it to zero; otherwise, gain will be added
[Link] ("RxGain", DoubleValue (0) );
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b
[Link] (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);

YansWifiChannelHelper wifiChannel;
[Link] ("ns3::ConstantSpeedPropagationDelayModel");
// The below FixedRssLossModel will cause the rss to be fixed
regardless // of the distance between the two stations, and the transmit
power
[Link] ("ns3::FixedRssLossModel","Rss",DoubleValue (rss));
[Link] ([Link] ());

// Add a mac and disable rate control


WifiMacHelper wifiMac;
[Link] ("ns3::ConstantRateWifiManager",
"DataMode",StringValue (phyMode),
"ControlMode",StringValue (phyMode));

// Setup the rest of the mac


Ssid ssid = Ssid ("wifi-default");
// setup sta.
[Link] ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
NetDeviceContainer staDevice = [Link] (wifiPhy, wifiMac, [Link] (0));
NetDeviceContainer devices =
staDevice; // setup ap.
[Link] ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));
NetDeviceContainer apDevice = [Link] (wifiPhy, wifiMac, [Link] (1));
[Link] (apDevice);

// Note that with FixedRssLossModel, the positions below are


not // used for received signal strength.
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0)); positionAlloc->Add (Vector (5.0, 0.0,
0.0)); [Link] (positionAlloc);
[Link] ("ns3::ConstantPositionMobilityModel");
[Link] (c);

InternetStackHelper internet;
[Link] (c);

Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
[Link] ("[Link]", "[Link]");
Ipv4InterfaceContainer i = [Link] (devices);

TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");


Ptr<Socket> recvSink = Socket::CreateSocket ([Link] (0), tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80); recvSink-
>Bind (local);
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));

Ptr<Socket> source = Socket::CreateSocket ([Link] (1), tid);


InetSocketAddress remote = InetSocketAddress (Ipv4Address ("[Link]"), 80);
source->SetAllowBroadcast (true);
source->Connect (remote);

// Tracing
[Link] ("wifi-simple-infra", devices);

// Output what we are doing


NS_LOG_UNCOND ("Testing " << numPackets << " packets sent with receiver rss " << rss
);

Simulator::ScheduleWithContext (source->GetNode ()->GetId (),


Seconds (1.0), &GenerateTraffic,
source, packetSize, numPackets, interPacketInterval);

Simulator::Stop (Seconds (30.0));


Simulator::Run ();
Simulator::Destroy ();

return 0;
}
3. WIFI SIMPLE ADHOC MODE
This script configures two nodes on an 802.11b physical layer, with 802.11b NICs in adhoc mode,
and by default, sends one packet of 1000 (application) bytes to the other node. The physical
layer is configured to receive at a fixed RSS (regardless of the distance and transmit power);
therefore, changing position of the nodes has no effect.

There are a number of command-line options available to control the default behavior. The list
of available command-line options can be listed with the following command: ./waf --run
"wifisimple-adhoc --help" For instance, for this configuration, the physical layer will stop
successfully receiving packets when rss drops below -97 dBm To see this effect, try running:

./waf --run "wifi-simple-adhoc --rss=-97 --numPackets=20"


./waf --run "wifi-simple-adhoc --rss=-98 --numPackets=20"
./waf --run "wifi-simple-adhoc --rss=-99 --numPackets=20"

Note that all ns-3 attributes (not just the ones exposed in the below script) can be changed at
ommand line; see the documentation.

This script can also be helpful to put the Wifi layer into verbose logging mode; this command
will turn on all wifi logging:

./waf --run "wifi-simple-adhoc --verbose=1"


When you are done, you will notice two pcap trace files in your directory. If you have tcpdump
installed, you can try this:
tcpdump -r [Link] -nn -tt

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/config-store-module.h"
#include "ns3/wifi-module.h"
#include "ns3/internet-module.h"

#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("WifiSimpleAdhoc");

void ReceivePacket (Ptr<Socket> socket)


{
while (socket->Recv ())
{
NS_LOG_UNCOND ("Received one packet!");
}
}

static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize,


uint32_t pktCount, Time pktInterval )
{
if (pktCount > 0)
{
socket->Send (Create<Packet> (pktSize));
Simulator::Schedule (pktInterval, &GenerateTraffic,
socket, pktSize,pktCount-1, pktInterval);
}
else
{
socket->Close ();
}
}
int main (int argc, char *argv[])
{
std::string phyMode ("DsssRate1Mbps");
double rss = -80; // -dBm uint32_t
packetSize = 1000; // bytes uint32_t
numPackets = 1; double interval = 1.0; //
seconds bool verbose = false;

CommandLine cmd;

[Link] ("phyMode", "Wifi Phy mode", phyMode);


[Link] ("rss", "received signal strength", rss);
[Link] ("packetSize", "size of application packet sent", packetSize);
[Link] ("numPackets", "number of packets generated", numPackets);
[Link] ("interval", "interval (seconds) between packets", interval); [Link]
("verbose", "turn on all WifiNetDevice log components", verbose);

[Link] (argc,
argv); // Convert to time
object
Time interPacketInterval = Seconds (interval);

// disable fragmentation for frames below 2200 bytes


Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold",
StringValue ("2200"));
// turn off RTS/CTS for frames below 2200 bytes
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue
("2200"));
// Fix non-unicast data rate to be the same as that of unicast
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
StringValue (phyMode));

NodeContainer c;
[Link] (2);

// The below set of helpers will help us to put together the wifi NICs we want
WifiHelper wifi;
if (verbose)
{
[Link] (); // Turn on all Wifi logging
}
[Link] (WIFI_PHY_STANDARD_80211b);
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
// This is one parameter that matters when using FixedRssLossModel
// set it to zero; otherwise, gain will be added
[Link] ("RxGain", DoubleValue (0) );
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b
[Link] (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);

YansWifiChannelHelper wifiChannel;
[Link] ("ns3::ConstantSpeedPropagationDelayModel");
// The below FixedRssLossModel will cause the rss to be fixed
regardless // of the distance between the two stations, and the transmit
power
[Link] ("ns3::FixedRssLossModel","Rss",DoubleValue (rss));
[Link] ([Link] ());

// Add a mac and disable rate control


WifiMacHelper wifiMac;
[Link] ("ns3::ConstantRateWifiManager",
"DataMode",StringValue (phyMode),
"ControlMode",StringValue (phyMode));
// Set it to adhoc mode
[Link] ("ns3::AdhocWifiMac");
NetDeviceContainer devices = [Link] (wifiPhy, wifiMac, c);

// Note that with FixedRssLossModel, the positions below are


not // used for received signal strength.
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0)); positionAlloc->Add (Vector (5.0, 0.0,
0.0)); [Link] (positionAlloc);
[Link] ("ns3::ConstantPositionMobilityModel");
[Link] (c);

InternetStackHelper internet;
[Link] (c);

Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
[Link] ("[Link]", "[Link]");
Ipv4InterfaceContainer i = [Link] (devices);

TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");


Ptr<Socket> recvSink = Socket::CreateSocket ([Link] (0), tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80); recvSink-
>Bind (local);
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));

Ptr<Socket> source = Socket::CreateSocket ([Link] (1), tid);


InetSocketAddress remote = InetSocketAddress (Ipv4Address ("[Link]"), 80);
source->SetAllowBroadcast (true);
source->Connect (remote);

// Tracing
[Link] ("wifi-simple-adhoc", devices);

// Output what we are doing


NS_LOG_UNCOND ("Testing " << numPackets << " packets sent with receiver rss " << rss
);

Simulator::ScheduleWithContext (source->GetNode ()->GetId (),


Seconds (1.0), &GenerateTraffic,
source, packetSize, numPackets, interPacketInterval);

Simulator::Run ();
Simulator::Destroy ();

return 0;
}

4. WIFI TO WIRED BRIDGING

Default network topology includes some number of AP nodes specified by the variable nWifis
(defaults to two). Off of each AP node, there are some number of STA nodes specified by the
variable nStas (defaults to two). Each AP talks to its associated STA nodes. There are bridge net
devices on each AP node that bridge the whole thing into one network.

//
// +-----+ +-----+ +-----+ +-----+
// | STA | | STA | | STA | | STA |
// +-----+ +-----+ +-----+ +-----+
// [Link] [Link] [Link] [Link]
// -------- -------- -------- --------
// WIFI STA WIFI STA WIFI STA WIFI STA
// -------- -------- -------- --------
// ((*)) ((*)) | ((*)) ((*))
// |
// ((*)) | ((*))
// ------- -------
// WIFI AP CSMA ========= CSMA WIFI AP
// ------- ---- ---- -------
// ############## ##############
// BRIDGE BRIDGE
// ############## ##############
// [Link] [Link]
// +---------+ +---------+
// | AP Node | | AP Node |
// +---------+ +---------+
//

#include "ns3/core-module.h"
#include "ns3/mobility-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/bridge-helper.h"
#include <vector>
#include <stdint.h>
#include <sstream>
#include <fstream>

using namespace ns3;

int main (int argc, char *argv[])


{
uint32_t nWifis = 2;
uint32_t nStas = 2;
bool sendIp = true;
bool writeMobility = false;

CommandLine cmd;
[Link] ("nWifis", "Number of wifi networks", nWifis);
[Link] ("nStas", "Number of stations per wifi network", nStas);
[Link] ("SendIp", "Send Ipv4 or raw packets", sendIp);
[Link] ("writeMobility", "Write mobility trace", writeMobility);
[Link] (argc, argv);
NodeContainer backboneNodes;
NetDeviceContainer backboneDevices;
Ipv4InterfaceContainer backboneInterfaces;
std::vector<NodeContainer> staNodes;
std::vector<NetDeviceContainer> staDevices;
std::vector<NetDeviceContainer> apDevices;
std::vector<Ipv4InterfaceContainer> staInterfaces;
std::vector<Ipv4InterfaceContainer> apInterfaces;

InternetStackHelper stack;
CsmaHelper csma;
Ipv4AddressHelper ip;
[Link] ("[Link]", "[Link]");

[Link] (nWifis);
[Link] (backboneNodes);

backboneDevices = [Link] (backboneNodes);

double wifiX = 0.0;

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();


[Link] (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);

for (uint32_t i = 0; i < nWifis; ++i)


{
// calculate ssid for wifi subnetwork
std::ostringstream oss; oss <<
"wifi-default-" << i; Ssid ssid =
Ssid ([Link] ());

NodeContainer sta;
NetDeviceContainer staDev;
NetDeviceContainer apDev;
Ipv4InterfaceContainer staInterface;
Ipv4InterfaceContainer apInterface;
MobilityHelper mobility;
BridgeHelper bridge;
WifiHelper wifi;
WifiMacHelper wifiMac;
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
[Link] ([Link] ());
[Link] (nStas);
[Link] ("ns3::GridPositionAllocator",
"MinX", DoubleValue (wifiX),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (5.0),
"DeltaY", DoubleValue (5.0),
"GridWidth", UintegerValue (1),
"LayoutType", StringValue ("RowFirst"));

// setup the AP.


[Link] ("ns3::ConstantPositionMobilityModel");
[Link] ([Link] (i));
[Link] ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));
apDev = [Link] (wifiPhy, wifiMac, [Link] (i));

NetDeviceContainer bridgeDev;
bridgeDev = [Link] ([Link] (i), NetDeviceContainer (apDev,
[Link] (i)));

// assign AP IP address to bridge, not wifi


apInterface = [Link] (bridgeDev);

// setup the STAs


[Link] (sta);
[Link] ("ns3::RandomWalk2dMobilityModel",
"Mode", StringValue ("Time"),
"Time", StringValue ("2s"),
"Speed", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"),
"Bounds", RectangleValue (Rectangle (wifiX, wifiX+5.0,0.0,
(nStas+1)*5.0)));
[Link] (sta);
[Link] ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));
staDev = [Link] (wifiPhy, wifiMac, sta); staInterface
= [Link] (staDev);
// save everything in containers.
staNodes.push_back (sta); apDevices.push_back
(apDev); apInterfaces.push_back (apInterface);
staDevices.push_back (staDev);
staInterfaces.push_back (staInterface);
wifiX += 20.0;
}

Address dest;
std::string protocol; if
(sendIp)
{
dest = InetSocketAddress (staInterfaces[1].GetAddress (1), 1025);
protocol = "ns3::UdpSocketFactory";
}
else
{
PacketSocketAddress tmp; [Link]
(staDevices[0].Get (0)->GetIfIndex ()); [Link]
(staDevices[1].Get (0)->GetAddress ()); [Link]
(0x807);
dest = tmp;
protocol = "ns3::PacketSocketFactory";
}

OnOffHelper onoff = OnOffHelper (protocol, dest);


[Link] (DataRate ("500kb/s"));
ApplicationContainer apps = [Link] (staNodes[0].Get (0));
[Link] (Seconds (0.5));
[Link] (Seconds (3.0));

[Link] ("wifi-wired-bridging", apDevices[0]);


[Link] ("wifi-wired-bridging", apDevices[1]);

if (writeMobility)
{
AsciiTraceHelper ascii;
MobilityHelper::EnableAsciiAll ([Link] ("[Link]"));
}

Simulator::Stop (Seconds (5.0));


Simulator::Run ();
Simulator::Destroy ();
}
5. WIFI TO LTE(4G) CONNECTION

#include "ns3/lte-helper.h"
#include "ns3/epc-helper.h"

#include "ns3/core-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/wifi-module.h"
#include "ns3/csma-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"
#include <iostream>
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/point-to-point-helper.h"
#include <iomanip>
#include <string>
#include <fstream>
#include <vector>

NS_LOG_COMPONENT_DEFINE ("WimaxSimpleExample");

using namespace ns3;

int main (int argc, char *argv[])


{
Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
bool verbose = false;

int duration = 500, schedType = 0;


uint16_t numberOfUEs=2; //Default number of ues attached to each eNodeB

Ptr<LteHelper> lteHelper; //Define LTE


Ptr<EpcHelper> epcHelper; //Define EPC

NodeContainer remoteHostContainer; //Define the Remote Host


NetDeviceContainer internetDevices; //Define the Network Devices in the Connection
between EPC and the remote host

Ptr<Node> pgw; //Define the Packet Data Network Gateway(P-GW)


Ptr<Node> remoteHost; //Define the node of remote Host

InternetStackHelper internet; //Define the internet stack


PointToPointHelper p2ph; //Define Connection between EPC and the
Remote Host
Ipv4AddressHelper ipv4h; //Ipv4 address helper
Ipv4StaticRoutingHelper ipv4RoutingHelper; //Ipv4 static routing helper
Ptr<Ipv4StaticRouting> remoteHostStaticRouting;

Ipv4InterfaceContainer internetIpIfaces; //Ipv4 interfaces

CommandLine cmd;
[Link] ("scheduler", "type of scheduler to use with the network devices", schedType);
[Link] ("duration", "duration of the simulation in seconds", duration); [Link]
("verbose", "turn on all WimaxNetDevice log components", verbose); [Link] (argc, argv);
LogComponentEnable ("UdpClient", LOG_LEVEL_INFO);
LogComponentEnable ("UdpServer", LOG_LEVEL_INFO);
//LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
//LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);

NodeContainer ssNodes;
NodeContainer bsNodes;

[Link] (2);
[Link] (1);

uint32_t nCsma = 3;

NodeContainer p2pNodes;
[Link] (2);

PointToPointHelper pointToPoint;
[Link] ("DataRate", StringValue ("5Mbps"));
[Link] ("Delay", StringValue ("2ms"));

NetDeviceContainer p2pDevices;
p2pDevices = [Link] (p2pNodes);

NodeContainer csmaNodes;
[Link] ([Link] (1));
[Link] (nCsma);

CsmaHelper csma; [Link] ("DataRate",


StringValue ("100Mbps")); [Link] ("Delay",
TimeValue (NanoSeconds (6560)));

NetDeviceContainer csmaDevices;
csmaDevices = [Link] (csmaNodes);

NodeContainer wifiApNode = [Link] (0);

YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();


YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
[Link] ([Link] ());

WifiHelper wifi = WifiHelper::Default ();


[Link] ("ns3::AarfWifiManager");

NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();

Ssid ssid = Ssid ("ns-3-ssid");


[Link] ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));

NetDeviceContainer staDevices;
staDevices = [Link] (phy, mac, ssNodes);

[Link] ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));

NetDeviceContainer apDevices;
apDevices = [Link] (phy, mac, wifiApNode);

MobilityHelper mobility1;
[Link] ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (5.0),
"DeltaY", DoubleValue (10.0),
"GridWidth", UintegerValue (3),
"LayoutType", StringValue ("RowFirst")); [Link]
("ns3::ConstantPositionMobilityModel"); [Link] (wifiApNode);
([Link](0) -> GetObject<ConstantPositionMobilityModel>()) ->
SetPosition(Vector(100.0, 501.0, 0.0));
InternetStackHelper stack1;
[Link] (csmaNodes); [Link]
(wifiApNode);
[Link] (ssNodes);

Ipv4AddressHelper address1;

[Link] ("[Link]", "[Link]");


Ipv4InterfaceContainer p2pInterfaces;
p2pInterfaces = [Link] (p2pDevices);

[Link] ("[Link]", "[Link]");


Ipv4InterfaceContainer csmaInterfaces; csmaInterfaces
= [Link] (csmaDevices);

[Link] ("[Link]", "[Link]");


[Link] (staDevices);
[Link] (apDevices);

UdpEchoServerHelper echoServer (9);

ApplicationContainer serverApps1 = [Link] ([Link] (nCsma));


[Link] (Seconds (1.0));
[Link] (Seconds (duration+0.1));

UdpEchoClientHelper echoClient ([Link] (nCsma), 9);


[Link] ("MaxPackets", UintegerValue (1000));
[Link] ("Interval", TimeValue (Seconds (1.))); [Link]
("PacketSize", UintegerValue (1024));

ApplicationContainer clientApps1 =
[Link] ([Link] (0)); [Link]
(Seconds (2.0));
[Link] (Seconds (duration+0.1));

Ipv4GlobalRoutingHelper::PopulateRoutingTables ();

//[Link] ("third");
[Link] ("third", [Link] (0));
//[Link] ("third", [Link] (0), true);

lteHelper = CreateObject<LteHelper> ();


epcHelper = CreateObject<EpcHelper> ();

lteHelper->SetEpcHelper (epcHelper);
lteHelper->SetSchedulerType("ns3::RrFfMacScheduler"); lteHelper-
>SetAttribute ("PathlossModel",
StringValue ("ns3::FriisPropagationLossModel"));
pgw = epcHelper->GetPgwNode ();

[Link] (1);
remoteHost = [Link] (0);
[Link] (remoteHostContainer);

[Link] ("DataRate", DataRateValue (DataRate ("100Gb/s")));


[Link] ("Mtu", UintegerValue (1500)); [Link]
("Delay", TimeValue (Seconds (0.010))); internetDevices = [Link] (pgw,
remoteHost);

[Link] ("[Link]", "[Link]");


internetIpIfaces = [Link] (internetDevices);

remoteHostStaticRouting = [Link] (remoteHost->GetObject<Ipv4> ());


remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("[Link]"), Ipv4Mask ("[Link]"),
1);

std::cout << "2. Installing LTE+EPC+remotehost. Done!" << std::endl;

MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc;
positionAlloc = CreateObject<ListPositionAllocator> ();

positionAlloc->Add (Vector (0.0, 500.0, 0.0)); //STA

[Link] (positionAlloc);
[Link] ("ns3::ConstantVelocityMobilityModel");
[Link]([Link](0));

Ptr<ConstantVelocityMobilityModel> cvm = [Link](0)-


>GetObject<ConstantVelocityMobilityModel>();
cvm->SetVelocity(Vector (5, 0, 0)); //move to left to right 10.0m/s

positionAlloc = CreateObject<ListPositionAllocator> ();

positionAlloc->Add (Vector (0.0, 500.0, 10.0)); //MAG1AP positionAlloc-


>Add (Vector (0.0, 510.0, 0.0)); //MAG2AP

[Link] (positionAlloc);
[Link] ("ns3::ConstantPositionMobilityModel");

[Link] (NodeContainer([Link](0),[Link](1)));

NetDeviceContainer ssDevs, bsDevs;

bsDevs = lteHelper->InstallEnbDevice (bsNodes); ssDevs=lteHelper-


>InstallUeDevice (ssNodes);

for (uint16_t j=0; j < numberOfUEs; j++)


{
lteHelper->Attach ([Link](j), [Link](0));
}

Ipv4InterfaceContainer iueIpIface;
iueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ssDevs));

lteHelper->ActivateEpsBearer (ssDevs, EpsBearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT),


EpcTft::Default ());

UdpServerHelper udpServer;
ApplicationContainer serverApps;
UdpClientHelper udpClient;
ApplicationContainer clientApps;
udpServer = UdpServerHelper (100);

serverApps = [Link] ([Link] (0));


[Link] (Seconds (6));
[Link] (Seconds (duration));
udpClient = UdpClientHelper ([Link] (0), 100);
[Link] ("MaxPackets", UintegerValue (200000));
[Link] ("Interval", TimeValue (Seconds (0.004)));
[Link] ("PacketSize", UintegerValue (1024));

clientApps = [Link] (remoteHost);


[Link] (Seconds (6)); [Link]
(Seconds (duration)); lteHelper-
>EnableTraces ();

NS_LOG_INFO ("Starting simulation.....");


Simulator::Stop(Seconds(duration));

Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
return 0;
}
6. CREATING A SIMPLE WIFI ADHOC GRID

n20 n21 n22 n23 n24


n15 n16 n17 n18 n19
n10 n11 n12 n13 n14
n5 n6 n7 n8 n9
n0 n1 n2 n3 n4
The layout is affected by the parameters given to GridPositionAllocator; By
default, GridWidth is 5 and numNodes is 25..

Flow 1: 0->24
Flow 2: 20->4
Flow 3: 10->4

STEPS:
1. Setup a 5x5 wireless adhoc network with a grid. You may use examples/wireless/wifisimple-
[Link] as a base.

2. Install the OLSR routing protocol.

3. Setup three UDP traffic flows, one along each diagonal and one along the middle (at high
rates of transmission).

4. Setup the ns-3 flow monitor for each of these flows.

5. Now schedule each of the flows at times 1s, 1.5s, and 2s.

6. Now using the flow monitor, observe the throughput of each of the UDP flows. Furthermore,
use the tracing mechanism to monitor the number of packet collisions/drops at intermediary
nodes. Around which nodes are most of the collisions/drops happening?

7. Now repeat the experiment with RTS/CTS enabled on the wifi devices.

8. Show the difference in throughput and packet drops if any.

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/config-store-module.h"
#include "ns3/wifi-module.h"
#include "ns3/internet-module.h"
#include "ns3/olsr-helper.h"
#include "ns3/flow-monitor-module.h"
#include "myapp.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <string>

NS_LOG_COMPONENT_DEFINE ("Lab5");

using namespace ns3;

uint32_t MacTxDropCount, PhyTxDropCount, PhyRxDropCount;

void
MacTxDrop(Ptr<const Packet> p)
{
NS_LOG_INFO("Packet Drop");
MacTxDropCount++;
}

void PrintDrop()
{
std::cout << Simulator::Now().GetSeconds() << "\t" << MacTxDropCount << "\t"<<
PhyTxDropCount << "\t" << PhyRxDropCount << "\n";
Simulator::Schedule(Seconds(5.0), &PrintDrop);
}

void
PhyTxDrop(Ptr<const Packet> p)
{
NS_LOG_INFO("Packet Drop");
PhyTxDropCount++;
} void
PhyRxDrop(Ptr<const Packet> p)
{
NS_LOG_INFO("Packet Drop");
PhyRxDropCount++;
}
int main (int argc, char *argv[])
{
std::string phyMode ("DsssRate1Mbps");
double distance = 500; // m
uint32_t numNodes = 25; // by default, 5x5
double interval = 0.001; // seconds uint32_t
packetSize = 600; // bytes
uint32_t numPackets = 10000000;
std::string rtslimit = "1500";
CommandLine cmd;

[Link] ("phyMode", "Wifi Phy mode", phyMode);


[Link] ("distance", "distance (m)", distance);
[Link] ("packetSize", "distance (m)", packetSize);
[Link] ("rtslimit", "RTS/CTS Threshold (bytes)", rtslimit);
[Link] (argc, argv); // Convert to time object
Time interPacketInterval = Seconds (interval);

// turn off RTS/CTS for frames below 2200 bytes


Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue
(rtslimit));
// Fix non-unicast data rate to be the same as that of unicast
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue
(phyMode));

NodeContainer c;
[Link] (numNodes);

// The below set of helpers will help us to put together the wifi NICs we want
WifiHelper wifi;

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();


// set it to zero; otherwise, gain will be added
[Link] ("RxGain", DoubleValue (-10) );
// ns-3 supports RadioTap and Prism tracing extensions for 802.11b
[Link] (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);

YansWifiChannelHelper wifiChannel;
[Link]
("ns3::ConstantSpeedPropagationDelayModel"); [Link]
("ns3::FriisPropagationLossModel"); [Link] ([Link] ());

// Add a non-QoS upper mac, and disable rate control


NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
[Link] (WIFI_PHY_STANDARD_80211b);
[Link] ("ns3::ConstantRateWifiManager",
"DataMode",StringValue (phyMode),
"ControlMode",StringValue (phyMode));
// Set it to adhoc mode
[Link] ("ns3::AdhocWifiMac");
NetDeviceContainer devices = [Link] (wifiPhy, wifiMac, c);

MobilityHelper mobility;
[Link] ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (distance),
"DeltaY", DoubleValue (distance),
"GridWidth", UintegerValue (5),
"LayoutType", StringValue ("RowFirst"));
[Link] ("ns3::ConstantPositionMobilityModel"); [Link]
(c);

// Enable OLSR
OlsrHelper olsr;

Ipv4ListRoutingHelper list;
[Link] (olsr, 10);

InternetStackHelper internet;
[Link] (list); // has effect on the next Install ()
[Link] (c);

Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
[Link] ("[Link]", "[Link]");
Ipv4InterfaceContainer ifcont = [Link] (devices);

// Create Apps

uint16_t sinkPort = 6; // use the same for all apps

// UDP connection from N0 to N24

Address sinkAddress1 (InetSocketAddress ([Link] (24), sinkPort)); // interface of


n24
PacketSinkHelper packetSinkHelper1 ("ns3::UdpSocketFactory", InetSocketAddress
(Ipv4Address::GetAny (), sinkPort));
ApplicationContainer sinkApps1 = [Link] ([Link] (24)); //n2 as sink
[Link] (Seconds (0.));
[Link] (Seconds (100.));

Ptr<Socket> ns3UdpSocket1 = Socket::CreateSocket ([Link] (0),


UdpSocketFactory::GetTypeId ()); //source at n0

// Create UDP application at n0


Ptr<MyApp> app1 = CreateObject<MyApp> ();
app1->Setup (ns3UdpSocket1, sinkAddress1, packetSize, numPackets, DataRate ("1Mbps"));
[Link] (0)->AddApplication (app1); app1-
>SetStartTime (Seconds (31.));
app1->SetStopTime (Seconds (100.));

// UDP connection from N10 to N14

Address sinkAddress2 (InetSocketAddress ([Link] (14), sinkPort)); // interface of


n14
PacketSinkHelper packetSinkHelper2 ("ns3::UdpSocketFactory", InetSocketAddress
(Ipv4Address::GetAny (), sinkPort));
ApplicationContainer sinkApps2 = [Link] ([Link] (14)); //n14 as sink
[Link] (Seconds (0.));
[Link] (Seconds (100.));

Ptr<Socket> ns3UdpSocket2 = Socket::CreateSocket ([Link] (10),


UdpSocketFactory::GetTypeId ()); //source at n10

// Create UDP application at n10


Ptr<MyApp> app2 = CreateObject<MyApp> ();
app2->Setup (ns3UdpSocket2, sinkAddress2, packetSize, numPackets, DataRate ("1Mbps"));
[Link] (10)->AddApplication (app2); app2->SetStartTime (Seconds (31.5));
app2->SetStopTime (Seconds (100.));

// UDP connection from N20 to N4

Address sinkAddress3 (InetSocketAddress ([Link] (4), sinkPort)); // interface of


n4
PacketSinkHelper packetSinkHelper3 ("ns3::UdpSocketFactory", InetSocketAddress
(Ipv4Address::GetAny (), sinkPort));
ApplicationContainer sinkApps3 = [Link] ([Link] (4)); //n2 as sink
[Link] (Seconds (0.));
[Link] (Seconds (100.));
Ptr<Socket> ns3UdpSocket3 = Socket::CreateSocket ([Link] (20),
UdpSocketFactory::GetTypeId ()); //source at n20

// Create UDP application at n20


Ptr<MyApp> app3 = CreateObject<MyApp> ();
app3->Setup (ns3UdpSocket3, sinkAddress3, packetSize, numPackets, DataRate
("1Mbps"));
[Link] (20)->AddApplication (app3); app3-
>SetStartTime (Seconds (32.));
app3->SetStopTime (Seconds (100.));

// Install FlowMonitor on all nodes


FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor = [Link]();

// Trace Collisions

Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx
Drop", MakeCallback(&MacTxDrop));

Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxD
rop", MakeCallback(&PhyRxDrop));

Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxD
rop", MakeCallback(&PhyTxDrop));

Simulator::Schedule(Seconds(5.0), &PrintDrop);

Simulator::Stop (Seconds (100.0));


Simulator::Run ();

PrintDrop();

// Print per flow statistics monitor-


>CheckForLostPackets ();
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>
([Link] ());
std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator iter = [Link] (); iter !=


[Link] (); ++iter)
{
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (iter->first);

if (([Link] == Ipv4Address("[Link]") && [Link] ==


Ipv4Address("[Link]"))
|| ([Link] == Ipv4Address("[Link]") && [Link] ==
Ipv4Address("[Link]"))
|| ([Link] == Ipv4Address("[Link]") && [Link] ==
Ipv4Address("[Link]")))
{
NS_LOG_UNCOND("Flow ID: " << iter->first << " Src Addr " << [Link]
<< " Dst Addr " << [Link]);
NS_LOG_UNCOND("Tx Packets = " << iter->[Link]);
NS_LOG_UNCOND("Rx Packets = " << iter->[Link]);
NS_LOG_UNCOND("Throughput: " << iter->[Link] * 8.0 / (iter-
>[Link]()-iter->[Link]()) / 1024
<< " Kbps");
}
}
monitor->SerializeToXmlFile("[Link]", true, true);

Simulator::Destroy ();

return 0;
}
7. To Study Architecture of GSM.

System Architecture

• A GSM network consists of several functional entities, whose functions and


interfaces are defined. The GSM network can be divided into following broad parts.
• The Mobile Station (MS)
• The Base Station Subsystem (BSS)
• The Network Switching Subsystem (NSS)
• The Operation Support Subsystem OSS)
• A GSM Public Land Mobile Network (PLMN) consists of at least one Service Area
controlled by a Mobile Switching Center (MSC) connected to the Public Switched
Telephone Network (PSTN)
• The architecture of a GSM Public Land Mobile Network (PLMN)

• A Base Station Subsystem (BSS) consists of o A Base Station Controller (BSC)


• At least one radio access point or Base Transceiver Station (BTS) for
Mobile Stations (MS), which are mobile phones or other handheld
devices (for example PDA computers) with phone interface.
• A BTS, with its aerial and associated radio frequency components, is the actual
transmission and reception component. A Network Cell is the area of radio coverage
by one BTS. One or more BTSs are in turn managed by a BSC. A network cell
cluster covered by one or several BSSs can be managed as a Location Area (LA).
All these BSSs must however be controlled by a single MSC.
• Figure shows three LAs of 3, 4 and 4 cells respectively with a MS moving across
cell and LA boundaries where a MS moving across cell and LA boundaries. 3 LAs
consisting of 4 and 5 cells respectively are shown.

• A more detailed architecture of a single MSC controlled Service Area is outlined in


figure below.
• components of the tree GSM network subsystems
• Radio Subsystem (RSS) consisting of the BSSs and all BSS connected MS devices.
• Network and Switching Subsystem
(NSS)
• Operation Subsystem (OSS)
• Specified in GSM 01.02 (‘General description of a GSM Public Land Mobile
Network(PLMN)’) and the GSM components are,

ME = Mobile Equipment
BTS = Base Receiving Station
BSC = Base Station Controller
MSC = Mobile Switching Center
VLR = Visitor Location Register
OMC = Operation and Maintenance Center
AuC = Authentication Center
HLR = Home Location Register
EIR = Equipment Identity Register
SMSC = Short Message Service
Centre
• A MSC is also through a Gateway MSC (GMSC) connected to other MSCs and to the
Public Switched Telephone Network (PSTN) with the Integrated Services Digital
Network (ISDN) option. The Inter-Working Function (IWF) of GMSC connects the
circuit switched data paths of a GSM network with the PSTN/ISDN. A GMSC is
usually integrated in an MSC.
• Basic GSM network components,

Common questions

Powered by AI

In the ns-3 Wifi simulation, non-unicast data rates are managed to be consistent with unicast data rates by setting the `NonUnicastMode` to match the `DataMode`. This ensures that both types of transmissions use the same data rate, which is important for network behavior consistency. This configuration is achieved by explicitly setting the `NonUnicastMode` to the same rate as `DataMode` in the ConstantRateWifiManager settings. The non-unicast data rate thus reflects the unicast rate ensuring uniformity across communication types .

The MobilityHelper in ns-3 configures how nodes move within the simulation environment, directly affecting signal reception dynamics. By setting the `MobilityModel`, such as 'ConstantPositionMobilityModel', nodes can simulate stationary conditions, whereas models like 'RandomWalk2dMobilityModel' simulate mobility. The tool also sets the position allocator that defines initial node positions. Although with models like `FixedRssLossModel` reception isn't affected by mobility, in other scenarios, node movement changes link qualities, reflecting real-world scenarios where mobility impacts connectivity and performance, making it a critical element for realistic simulations .

The FixedRssLossModel in the ns-3 simulation environment ensures that the received signal strength is constant regardless of the physical distance between nodes and the transmit power. This model is significant in scenarios where mobility or changes in spatial configuration do not affect the reception, focusing instead on static parameters for performance analysis. Adjusting its configuration, such as changing the 'Rss' value, affects when packets are successfully received. For instance, setting 'Rss' to a value above -97 dBm allows successful receptions. Below this threshold, packets may be lost, as demonstrated by running the script with an RSS of -98 or -99 dBm where packets are expected not to be received .

Disabling the RTS/CTS mechanism in ns-3 simulations can potentially reduce the overhead in packet transmission, leading to increased throughput efficiency, particularly in scenarios where the packet sizes are small relative to the threshold set for RTS/CTS triggering. This decision is beneficial in environments with low contention levels and minimal interference, as the mechanism is traditionally used to avoid the 'hidden node' problem and collisions in dense networks. By setting the `RtsCtsThreshold` to high values, simulations can observe performance changes when the control frames are bypassed, efficient in theoretical or controlled environments with low collision risk .

In ns-3 simulations, logging capabilities for Wi-Fi components can be activated to enhance visibility and debugging. By leveraging the `EnableLogComponents` function, users can turn on comprehensive logging, providing granular insights into network operations such as packet transmissions, receptions, and node behavior. This process is activated by setting the verbose option during script execution, enabling detailed output from the `WifiNetDevice` logs. Through this feature, developers gain a deeper understanding of interactions and possible issues within the simulation, which assists in refining configurations and understanding protocol performance .

PropagationLossModels in ns-3 determine how signal strength attenuates over distance, shaping network performance scenarios. The `FixedRssLossModel`, for example, controls signal loss so the RSS remains constant regardless of actual distance, useful for testing under static conditions. In contrast, models like `FriisPropagationLossModel` simulate realistic signal degradation over distance, crucial for understanding real-world wireless environments. These differing assumptions fundamentally impact outcomes in performance metrics like throughput and latency, revealing trade-offs between theoretical analysis precision and practical relevance in varying settings .

In ns-3 Wi-Fi simulations, Adhoc mode allows direct communication between nodes without a central coordination point like an access point, making it suitable for decentralized networks or environments where infrastructure is unavailable. It leverages the `AdhocWifiMac` type. Infrastructure mode, however, employs a central access point coordinating the traffic between nodes (`ApWifiMac` and `StaWifiMac` types), facilitating managed connections and often supporting better scalability and security. The choice between these modes affects network setup complexity, with Infrastructure mode requiring more configuration for the AP but generally offering stable performance under higher node densities. Adhoc mode is simpler but can face challenges in range and collision management .

The Ipv4GlobalRoutingHelper in ns-3 facilitates routing in network simulations by setting up default global routing tables across nodes. It enables nodes to automatically handle packet forwarding based on the network topology without explicitly defined routing tables by the user. The helper ensures that routes are correctly established based on the connectivity graph, which is crucial for simulations where dynamic or complex routing needs to be examined. By employing this tool, users simplify the setup of routing parameters, allowing them to focus on higher-level aspects of network behavior .

The 'EnablePcapAll' option in ns-3 is crucial for capturing packets across the entire network simulation, producing pcap trace files that can be analyzed post-simulation. This capability is important for debugging and understanding network behavior, as it allows users to inspect all packets transmitted and received across nodes. Analyzing these captures using tools like tcpdump provides insights into packet flows, loss, latency, and other metrics that are critical for validation and performance analysis. The ability to trace all activities in detail facilitates in-depth troubleshooting and refinement of network protocols and configurations .

A GSM network is composed of several key components: Mobile Station (MS), Base Station Subsystem (BSS), Network Switching Subsystem (NSS), and the Operation Support Subsystem (OSS). The MS, commonly mobile phones or handheld devices, communicates with the BSS, which includes the Base Station Controller (BSC) and Base Transceiver Stations (BTS). The NSS, with the Mobile Switching Center (MSC), facilitates the network's switching and management tasks. These components interact to ensure seamless communication, with the BTS providing wireless access to the MS, and the BSC managing resources and handover processes within the BSS .

You might also like