Hi All, Our website moved to a new URL. Please bookmark the new link: https://ns2bloggers.blogspot.com/

Thursday 31 July 2014

SIMULATION OF ALOHA PROTOCOL USING NS2

ALOHA is a protocol for satellite and terrestrial radio transmissions. In pure Aloha, a user can transmit at any time but risks collisions with other users' messages. "Slotted Aloha" reduces the chance of collisions by dividing the channel into time slots and requiring that the user send only at the beginning of a time slot. Aloha was the basis for Ethernet, a local area network protocol.

Pure ALOHA

Graph of frames being sent from 4 different stations according to the pure ALOHA protocol with respect to time, with overlapping frames shaded to denote collision. The first version of the protocol (now called "Pure ALOHA", and the one implemented in ALOHAnet) was quite simple:
  • If you have data to send, send the data
  • If, while you are transmitting data, you receive any data from another station, there has been a message collision. All transmitting stations will need to try re sending "later".
Boxes indicate frames. Shaded boxes indicate frames which have collided.


Note that the first step implies that Pure ALOHA does not check whether the channel is busy before transmitting. Since collisions can occur and data may have to be sent again, ALOHA cannot use 100% of the capacity of the communications channel. How long a station waits until it transmits, and the likelihood a collision occurs are interrelated, and both effect how efficiently the channel can be used. This means that the concept of "transmit later" is a critical aspect: the quality of the backoff scheme chosen significantly influences the efficiency of the protocol, the ultimate channel capacity, and the predictability of its behavior.

Slotted ALOHA

An improvement to the original ALOHA protocol was "Slotted ALOHA", which introduced discrete time slots and increased the maximum throughput.A station can send only at the beginning of a time slot, and thus collisions are reduced. In this case, we only need to worry about the transmission-attempts within 1 frame-time and not 2 consecutive frame-times, since collisions can only occur during each time slot. 


Thus, the probability of there being zero transmission-attempts in a single time slot is:

Prob_{slotted} = e^{-G}

the probability of k packets is:

Prob_{slotted} k =  e^{-G} ( 1 - e^{-G} )^{k-1}

The throughput is:

S_{slotted}=Ge^{-G}

The maximum throughput is 1/e frames per frame-time (reached when G = 1), which is approximately 0.368 frames per frame-time, or 36.8%. Slotted ALOHA is used in low-data-rate tactical satellite communications networks by military forces, in subscriber-based satellite communications networks, mobile telephony call setup, set-top box communications and in the contact less RFID technologies.

The use of a random-access channel in ALOHAnet led to the development of carrier sense multiple access (CSMA), a "listen before send" random-access protocol that can be used when all nodes send and receive on the same channel. The first implementation of CSMA was Ethernet. CSMA in radio channels was extensively modeled.[11] The AX.25 packet radio protocol is based on the CSMA approach with collision recovery,[12] based on the experience gained from ALOHAnet.

ALOHA and the other random-access protocols have an inherent variability in their throughput and delay performance characteristics. For this reason, applications which need highly deterministic load behavior sometimes used polling or token-passing schemes (such as token ring) instead of contention systems. For instance ARCNET was popular in embedded data applications in the 1980 network.


Script for wired connection:

Thursday 17 July 2014

NS2 INSTALLATION VIA CYGWIN FOR WINDOWS

Here we are providing you the user manual to installing ns2 on windows by using Cygwin. Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows. In this post, I will show you how to install NS2.

For User Guide, Click here 





Monday 14 July 2014

SIMULATION OF WIRELESS PERSONAL AREA NETWORK [WPAN] IN NS2

A personal area network (PAN) is a computer network used for data transmission among devices such as computers, telephones and personal digital assistants. PANs can be used for communication among the personal devices themselves (intrapersonal communication), or for connecting to a higher level network and the Internet (an uplink). A wireless personal area network (WPAN) is a PAN carried over wireless network technologies such as:

  • IrDA
  • Wireless USB
  • Bluetooth
  • Z-Wave
  • ZigBee
  • Body Area Network

The reach of a WPAN varies from a few centimeters to a few meters. A PAN may also be carried over wiredcomputer buses such as USB and FireWire.

Wireless Personal Area Network
A wireless personal area network (WPAN) is a personal area network — a network for interconnecting devices centered on an individual person's workspace — in which the connections are wireless. Wireless PAN is based on the standard IEEE 802.15. The two kinds of wireless technologies used for WPAN are Bluetooth and Infrared Data Association.

A WPAN could serve to interconnect all the ordinary computing and communicating devices that many people have on their desk or carry with them today; or it could serve a more specialized purpose such as allowing the surgeon and other team members to communicate during an operation.

A key concept in WPAN technology is known as "plugging in". In the ideal scenario, when any two WPAN-equipped devices come into close proximity (within several meters of each other) or within a few kilometers of a central server, they can communicate as if connected by a cable. Another important feature is the ability of each device to lock out other devices selectively, preventing needless interference or unauthorized access to information.

The technology for WPANs is in its infancy and is undergoing rapid development. Proposed operating frequencies are around 2.4 GHz in digital modes. The objective is to facilitate seamless operation among home or business devices and systems. Every device in a WPAN will be able to plug into any other device in the same WPAN, provided they are within physical range of one another. In addition, WPANs worldwide will be interconnected. Thus, for example, an archeologist on site in Greece might use a PDA to directly access databases at the University of Minnesota in Minneapolis, and to transmit findings to that database.

In NS2 we need two special commands during the simulation of WPAN [IEEE 802.15.4];

$ns at 0.0 "$node_(0) sscs startPANCoord"; # <txBeacon=1><BO=3> <SO=3>

This command is used to start PAN Coordinator and we write its syntax as like this with default values as txtBecon = 1,Becon Order =3 and Superframe Order = 3. Otherwise we can write as; 
"$node_(0) sscs startPANCoord 1 5 4"

$ns at 0.0 "$node_(1) sscs startDevice"# <isFFD=1><assoPermit=1><txBeacon=0><BO=3><SO=3>

This command is used to start device and we write its syntax as like this with default values as txtBecon = 1,Becon Order =3 and Superframe Order = 3. 

"$node_(1) sscs startDevice 1 0"    ====> becon diabled
"$node_(1) sscs startDevice 1 1 1" ====> becon enabled


For Script; Click here 


SCREEN SHOT

terminal

NAM Window





Wednesday 9 July 2014

ENCRYPTION AND DECRYPTION FUNCTION FOR NS2

Here, we are describing encryption and decryption techniques for the NS2 by adding an agent in the ns2 directory.

For script and details, Click here