Simulation of a WiMAX network to evaluate the performance of MAC IEEE 802.16 during the IR phase of Network Entry and Initialization

Pervasive Computing is also called as Ubiquitous Computing, which means “being present everywhere at once” or “constantly encountered”. The main idea behind making these pervasive computing systems is that these systems improve living by performing computations on their own, without having to be monitored by anyone. These systems are targeted to become invisible to the user i.e., they perform their tasks without the user’s knowledge. 
To achieve this environment, the underlying requirement is a Network. One of the biggest constraints in achieving this environment is the “Last Mile” problem. It refers to the last leg of delivering connectivity from a communications provider to a customer. In recent years there has been increasing interest shown in wireless technologies for subscriber access, as an alternative to traditional twisted-pair local loop. 
WiMAX, Worldwide Interoperability for Microwave Access, is a Telecommunications technology that provides wireless transmission of data and is based on the IEEE 802.16 standard (also called Broadband Wireless Access). 802.16 uses paired radio channels Up Link Channel (UL) and Down Link Channel (DL) for establishing a communication between Base Station (BS) and Subscriber Station (SS). When a SS wants to establish connectivity with a BS it goes through the Network Entry and Initialization procedure of which Initial Ranging (IR) is a very important part. IR is the process of acquiring the correct timing offset and power adjustments such that the SS’s transmissions are aligned to maintain the UL connection with the BS. All the SS’s of a BS will compete for the contention slots for their network entry. Whenever the SS has to transmit the request packets it performs the Truncated Binary Exponential Backoff procedure. This method is the contention resolution procedure used in IEEE 802.16 networks. 
Our focus here was to simulate a WiMAX network so as to evaluate the performance of MAC IEEE 802.16 during the IR phase of Network Entry and Initialization. We have used Network Simulator-2 (NS-2) for our simulation purposes. We are using WiMAX “patch” which simulates the PHY and the MAC features of a WiMAX network. We have evaluated the performance of MAC IEEE 802.16 for various topologies.


I. INTRODUCTION
Ubiquitous computing is roughly the opposite of virtual reality.Where virtual reality puts people inside a computergenerated world, ubiquitous computing forces the computer to live out here in the world with people.
Pervasive computing has many potential applications, from health and home care to environmental monitoring and intelligent transport systems.Pervasive computing systems [1] and services may lead to a greater degree of user knowledge of, or control over, the surrounding environment, whether at home, or in an office or car.They may also show a form of 'intelligence' that will make life easier.A few examples are worth mentioning here.A refrigerator can automatically signal the grocery shop once the milk or juice comes below a certain level, thus alleviating the owner from the task of notifying the grocery shop or going and buying.Various home appliances can become pervasive computing systems with similar 'intelligence', like a television that automatically switches on and tunes itself to a particular channel at a pre-defined time or an air conditioner that switches on automatically and brings the room to a specified temperature.A phone call can be made or answered only by gestures.
The main idea behind making these pervasive computing systems are, that these systems improve the living of the humans by performing the computation on their own, without having to be monitored by anyone.These systems are targeted to become invisible to the user i.e., they perform their tasks without the user's knowledge.

II. MATHEMATICAL ANALYSIS OF THE DELAY FOR THE IR SCHEME
In this section we analyze the IR scheme and evaluate mathematically the delay involved in the procedure.First we structure the IR mechanism as a set of distinct states with transitions among these states.Then this information is used to model IR as a Markov process [1].In a Markov process, the probability of the system making a transition to a particular state depends only on the state the system is currently in.www.ijacsa.thesai.orgAlso, in this Markov process, we calculate the delays associated with the transitions between the states.Finally, by making use of the delays and probabilities associated with each of the transitions, we derive a mathematical equation describing the total IR delay.The Markov process is derived for IR in case of OFDMA PHY, since it covers all the steps in the OFDM based procedure as well.In case of the OFDMA PHY, Code Division Multiple Access (CDMA) codes are used instead of the RNG-REQ messages in the first part of the IR procedure.

A. Modeling IR as a Markov Process
Markov processes [2] provide very flexible, powerful, and efficient means for the description and analysis of dynamic (computer) system properties.Performance a n d dependability measures can be easily derived.Moreover, Markov processes constitute the fundamental theory underlying the concept of queuing systems.In fact, the notation of queuing systems has been viewed sometimes as a high-level specification technique for (a sub-class of) Markov processes.A stochastic process is defined as a family of random T, which is usually called the time parameter if T is a subset of the set of positive real numbers.The set of all possible values of X t (for each t ∈ T) is known as the state space S of the stochastic process.A large number of stochastic processes belong to the important class of Markov processes.A stochastic process is a Markov process when the future state of the process depends only the current state and not on the history of the system.A Markov process is a memory-less stochastic process.
After analyzing the Initial Ranging procedure [3], we enumerate the following states as well as transitions needed for modeling the procedure.Using these probabilities we design the Markov process representation of IR.The states 6, 8 and 9 lead out of IR and are the absorbing states.For these states, transition occurs back to the same state with a probability one.In states 3 and 7, the outgoing probabilities are marked with algebraic symbols a1 to a4 and b1 to b3.This is because the probabilities of the transitions originating from these states are non-deterministic in nature.The sum of probabilities of all transitions originating from states 3 and 6 are still equal to 1. Next, the transition matrix is used to obtain the overall delay formula.
The details of the delays [4] involved along with the associated probabilities are given in the table 2. www.ijacsa.thesai.org

B. Mathematical Derivation of the Backoff Delay
Consider the first time an SS enters Backoff procedure [5].Let the Initial Contention window be w.The random number will be picked in the range [0, w-1].Let this random number be called k.The SS has to defer a total of k contention slots (CSs).Let the number of CSs in a frame be n.The number of frames that have to be deferred is k / n.00cscs.The delay involved here will be (k / ncs) * frame length.After k / ncs frames have passed the SS defers a further k modulo ncs CSs.The delay involved here is equal to (k % n cs) * Tcs, where Tcs is the length of one CS and % denotes the modulo operation.Therefore the total delay incurred so far is (k / n cs ) * frame length + (k % n cs ) * T cs .Here the value of k can vary from 0 to w 0 -1.Thus, we take an average of the delay over the random number.Next we make an assumption that the probability of a successful transmission in a CS is 'p'.Thus, probability of failure will be '1-p'.In case of a failure the contention window is doubled in size.Let the new window be equal to [0, w 1 -1].Similar to previous derivation the delay involved will be www.ijacsa.thesai.orgAD 1 = (1/w 1 ) *Sum of [(k/n cs )*frame length + (k% n cs )*T cs ] as k varies from 0 to w 1 -1.
Again there could be success or failure.So, it will enter the third Backoff window phase [0, w 2 -1].Continuing in this fashion, we get the following delays for the next three phases.We make another assumption at this point.The SS is assumed to complete successful transmission of its CDMA code, in a maximum of 5 Backoff phases.Thus, the worst case of transmission will be four failures followed be a success.The final formula for the delay will be as follows.
Here t is the time-out after which failure is assumed.So, we take half that value for success i.e. t/2.
Create a sink node.The sink node acts as a dropped target (any packets dropped at the base station are sent to the sink node.)ii.
Creating the mobile node and setting the location of the node in the topology created ii.
Disabling the random motion of the nodE iii.
Establishing the connection with Base Station(BS) iv.
Setting the motion for the mobile node v.
Setting the channel and Downlink Interval Usage Code(DIUC) set udp [new Agent/UDP] $udp set packetSize_ 100 $ns attach-agent $wl_node $udp These lines set up the UDP agent for each of the mobile node set cbr [new Application/Traffic/CBR] $cbr set packetSize_ 100 $cbr set rate_ 0.2Mb $cbr attach-agent $udp The above lines help in setting up a Constant Bit Rate (CBR) traffic source ,which is then attached to a UDP agent ('udp' in this case).The mobile nodes cannot exchange data on their own.They must have agents attached to them for this purpose.In simple words, traffic sources create traffic (packets), and agents exchange them.# Create the Null agent to sink traffic set null [new Agent/Null] $ns attach-agent $sinkNode $null # Attach the 2 agents $ns connect $udp $null The above lines set up a Null agent [13] (whose default behavior is to receive packets).Then the UDP agent and the Null agent are connected to establish a link between two nodes.
The above 4 code snippets are placed inside a for loop, which iterates 'n' number of times , where n is the number of mobile stations i.e. the for loop creates n mobile stations.
$ns at $traffic_start "$cbr start" $ns at $traffic_stop "$cbr stop" The above lines initiates and terminates the traffic source which will be in a for loop whose termination condition will be number of nodes at the time specified in the variables traffic_start and traffic_stop.proc finish {} { global ns tf out.txtnb_mn nf $ns flush-trace close $tf close $nf exec nam newrng-irmsa.nam& } This procedure is used to flush the trace of NAM output and close all the open file descriptor which was used for trace file and nam trace file.It also executes the nam file.$ns at $simulation_stop "finish" The above indicates to the simulator to stop the simulation at the time specified in variable simulation_stop.

$ns run
The above line marks the starting point for the simulation.[14],[15] 1. for nodes in 4 8 16 32 40 This line initializes an array which contains the number of nodes for which we are going to be running the simulation(s).This line initializes an array which contains the seed values for which we are going to be running the simulation(s).

ns newrng-irmsa.tcl $nodes $seed > out.txt
This line runs the ns command for the file newrngirmsa.tcl,passing $node and $seed as parameters.The output is redirected into the file out.txt.www.ijacsa.thesai.org 4. grep "found ranging opportunity" out.txt| cut -d " " -f 2 > startTime.txtThis line searches the file out.txt for lines containing "found ranging opportunity", which indicates that a ranging opportunity has been found at the specific times.The lines thus selected are passed to the cut function, where we select the 2nd column (field).The values in this column are stored in startTimes.txt,which thus contains the times at which the nodes start the initial ranging procedure.5. grep "Ranging response" out.txt| cut -d " " -f 2 > endTime.txtThis line searches the file out.txt for lines containing "Ranging Response", which indicates a ranging response has been found at the specific times.The lines thus selected are passed to the cut function, where we select the 2nd column (field).The values in this column are stored in endTimes.txt,which thus contains the times at which the nodes finish the initial ranging procedure.^"$newCounter " ourNewEndTimes.txt| cut -d " " -f 2` startt=`grep ^"$newCounter " ourNewStartTimes.txt| cut -d " " -f 2` delay[`expr $newCounter -1`]=`echo $endt -$startt | bc` newCounter=`expr $newCounter + 1` done These lines calculate the delays for all nodes.The start times are obtained from ourNewStartTimes.txt and the end times are obtained from ourNewEndTimes.txt.The delay for a node is the difference between the end time and start time for that particular node.We find the delay for all nodes by using a while loop, which iterates n number of times, where n is the number of nodes for this particular simulation.The delays are stored in an array called delay.These lines calculate the total delay, for a particular value of nodes and seed.The total delay is simply the sum of delays for individual nodes.9. avg=`echo "scale=10; $total_delay / $nodes" | bc` This line calculates the average delay for a particular value of nodes and seed.The average delay is the total delay, divided by the number of need.

10.
Echo "$nodes $seed $avg" >> finalAvg$nodes.txtThis line send the number of nodes, seed value and average delay for a particular simulation into a file called finalAvg$nodes.txt.The average delay for 4 nodes, and different seeds, will be stored in a file called finalAvg4.txt,and the average delay for 8 nodes, and different seeds, will be stored in a file called finalAvg8.txt,and so on.

-- 1 -
(a 1 +a 2 ) + a 3 * (RSP + CDMA_IE + RNG-REQ + RSP) + a 4 * RSP Now, the total delay involved can be represented using the formula given below.D total = D loop + a 3 * (RSP + CDMA_IE + RNG-REQ + (b 1 + b 2 + b 3 )*RSP) + a 4 * RSP (here b 1 + b 2 +b 3 = 1) Substituting the expression for the delay in the loop into the formula for overall delay in IR, we get the following final formula.D loop = UL + BD + CDMA sending + a 1 *T3 + a 2 *RSP --1-(a 1 +a 2 ) + a 3 * (RSP + CDMA_IE + RNG-REQ + RSP) + a 4 * RSP III.WORKING OF THE CODE A. TCL script The Tcl file [8],[9] contains the codes to run the simulation for 1 base station and variable number of mobile station.The file accepts the following arguments i.The number of mobile nodes/stations ii.The seed value (for random number generation) www.ijacsa.thesai.org

Fig. 5 .
Fig.5.Circular Topology with Random MotionTable 4-Average Delay for Circular topology with random motion

Fig. 7 .
Fig.7.Linear Topology with Linear Motion Table6-Average Delay for Linear topology with linear motion [12]#note: the higher the value the earlier the trigger Mac/802_16 set client_timeout_ 60 ;#to avoid BS disconnecting the SS God node created" The above lines are used to setup the simulation environment[12], which includesi.Creating a new instance of the ns2 simulator ii.Creating a new topology iii.Configuring the nam and trace files iv.Specifying that the entered value of the seed should be used by the default Random Number Generator v. Creating an address hierarchy, and configuring it * vi.Creating a 'God object'.The number of mobile nodes is passed as argument which is used by God to create a matrix to store connectivity information of the topology 6. nl -n ln endTime.txt| tr -d '\t' | tr -s ' '> ourNewEndTimes.txtnl -n ln startTime.txt| tr -d '\t' | tr -