13
Simulation of Wireless Network
Systems
This chapter deals with simulation of wireless network systems. We introduce the basics of
discrete-event simulation as it is the simulation technique that is used for simulating wireless
networks. We then review the main characteristics of the commonly used stochastic distribu-
tions used for the simulation of wireless networks. The techniques used to generate and test
random number sequences are investigated. Then, we introduce the techniques used to
generate random variates followed by performance metrics considerations. The chapter
concludes with cases studies on the simulation of some wireless network systems.
13.1 Basics of Discrete-Event Simulation
Simulation is a general term that is used in many disciplines including performance evalua-
tion of computer and telecommunications systems. It is the process of designing a model of a
real system and conducting experiments with this model for the purpose of understanding its
behavior, or of evaluating various strategies of its operation. Others defined simulation as the
process of experimenting with a model of the system under study using computer program-
ming. It measures a model of the system rather than the system itself.
A model is a description of a system by symbolic language or theory to be seen as a system
with which the world of objects can be expressed. Thus, a model is a system interpretation or
realization of a theory that is true. Shannon defined a model as ‘the process of designing a
computerized model of a system (or a process) and conducting experiments with this model
for the purpose either of understanding the behavior of the system or of evaluating various
strategies for the operation of the system.’
Based on the above definition of a model, we can redefine simulation as the use of a model,
which may be a computer model, to conduct experiments which, by inference, convey an
understanding of the behavior of the system under study. Simulation experiments are impor-
tant aspect of any simulation study since they help to:
†
discover something unknown or test an assumption
†
find candidate solutions, and provide a mean for evaluating them.
effect of variances. This may lead to erroneous conclusions.
†
Simulation promotes total solutions.
†
Simulation brings expertise, knowledge and information together.
†
Simulation can be cost effective in terms of time.
In order to conduct a systematic and effective simulation study and analysis, the following
phases should be followed [1,4,5]. Figure 13.1 summarizes these major steps.
†
Planning. In the planning phase, the following tasks have to be defined and identified:
–
Problem formulation. If a problem statement is being developed by the analyst, it is
important that policymakers understand and agree with the formulation.
–
Resource estimation. Here, an estimate of the resources required to collect data and
analyze the system should be conducted. Resources including time, money, personnel
and equipment, must be considered. It is better to modify goals of the simulation study
at an early stage rather than to fall short due to lack of critical resources.
–
System and data analysis. This includes a thorough search in the literature of previous
approaches, methodologies and algorithms for the same problem. Many projects have
failed due to misunderstanding of the problem at hand. Also, identifying parameters,
variables, initial conditions, and performance metrics is performed at these stages.
Furthermore, the level of detail of the model must be established.
Wireless Networks342
†
Modeling phase. In this phase, the analyst constructs a system model, which is a repre-
sentation of the real system.
–
†
Flow scheme. This scheme has been used to analyze systems that are characterized by the
flow of physical or information items through the system, such as pipeline computers.
†
Functional scheme. This scheme is useful when there are no directly observable flowing
entities in the system, such as manufacturing processes that do not use assembly lines.
†
State-change scheme. This scheme is useful in systems that are characterized by a large
number of interdependent relationships and that must be examined at regular intervals in
order to detect state changes.
13.1.2 Variable and Parameter Estimation
This is usually done by collecting data over some period of time and then computing a
frequency distribution for the desired variables. Such an analysis may help the analyst to
find a well-known distribution that can represent the behavior of the system or subsystem.
13.1.3 Selection of a Programming Language/Package
Here, the analyst should decide whether to use a general-purpose programming language, a
simulation language or a simulation package. In general, using a simulation package such as
NS2 or Opnet may save money and time, however, it may not be flexible and effective to use
simulation packages as they may not contain capabilities to do the task such as modules to
simulate the protocols or features of the network under study.
13.1.4 Verification and Validation (V&V)
Verification and validation are two important tasks that should be carried out for any simula-
tion study. They are often called V&V and many simulation journals and conferences have
special sections and tracks that deal with these tasks, respectively.
Verification is the process of finding out whether the model implements the assumptions
correctly. It is basically debugging the computer program (simulator) that implements the
model. A verified computer program can in fact represent an invalid model; a valid model can
also represent an unverified simulator.
Validation, on the other hand, refers to ensuring that the assumptions used in developing
the model are reasonable in that, if correctly implemented, the model would produce results
Speed. Using simulation allows us to find results of experiments in a speedy manner.
Simulation permits time compression of a system over an extended period of time.
†
Simulation modeling permits sensitivity analysis by manipulating input variables. It
allows us to find the parameters that influence the simulation results. It is important to
find out which simulation parameters influence performance metrics more than others as
proper selection of their operating values is essential for stable operation.
†
Simulation modeling involves programming, mathematics, queuing theory, statistics,
system engineering and science as well as technical documentation. Clearly, it is an
excellent training tool.
The main drawbacks of simulation are [4,5]:
†
It may become expensive and time-consuming especially for large simulation models.
This will consume long computer simulation time and manpower.
†
In simulation modeling, we usually make assumptions about input variables and para-
meters, and distributions, and if these assumptions are not reasonable, this may affect the
credibility of the analysis and the conclusions.
†
When simulating large networks or systems, the time to develop the simulator (simulation
program) may become long.
Simulation of Wireless Network Systems 345
†
It is usually difficult to initialize simulation model parameters properly and not doing so
may affect the credibility of the model as well as require longer simulation time.
13.2 Simulation Models
In general, simulation models can be classified in three different dimensions [3]: (a) a static
versus dynamic simulation model, where a static model is representation of a system at a
particular time, or one that may be used to represent a system in which time plays no role,
scheme.
The main components that are found in most discrete-event simulation models using the
next-event time advance scheme are [1–5]: (a) system state which is the collections of state
variables necessary to describe the system at a particular time; (b) simulation clock which is a
variable giving the current value of simulated time; (c) statistical counters which are the
variables used for storing statistical information about system performance; (d) an initializing
routine which is a procedure used to initialize the simulation model at time zero; (e) a timing
routine which is a procedure that determines the next event from the event list and then
Wireless Networks346
advances the simulation clock to the time when that event is to occur; (f) an event routine
which is a procedure that updates the system state when a particular type of event occurs; (g)
library routines that are a set of subprograms used to generate random observations from
probability distributions; (h) a report generator which is a procedure that computes estimates
of the desired measures of performance and produces a report when the simulation ends; and
(i) the main program which is a procedure that invokes the timing routine in order to
determine the next event and then transfers control to the corresponding event routine to
Simulation of Wireless Network Systems 347
Figure 13.2 Summary of next-event time advance scheme [1–5]
properly update the system state, checks for termination and invokes the report generator
when the conditions for terminating the simulation are satisfied.
Simulation begins at time 0 with the main program invoking the initialization routine,
where the simulation clock is initialized to zero, the system state and statistical counters are
initialized, as well as the event list. After control has been returned to the main program, it
invokes the timing routine to find out the most eminent routine. If event i is the most eminent
one, then simulation clock is advanced to the time that this event will occur and control is
returned to the main program.
The available programming languages/packages for simulating computers and network
systems are:
†
General purpose languages such as C, C11, Java, Fortran, and Visual Basic.
†
Bernoulli distribution. This is considered the simplest discrete distribution. A Bernoulli
variate can take only two values, which are denoted as failure and success, or x ¼ 0 and
Wireless Networks348
x ¼ 1, respectively. If p represents the probability of success, then q ¼ 1 2 p is the prob-
ability of failure. The experiments to generate a Bernoulli variate are called Bernoulli
trials. This distribution is used to model the probability of an outcome having a desired
class or characteristic; for example, a packet in a computer network reaches or does not
reach the destination, and a bit in a packet is affected by noise and arrives in error. The
Bernoulli distribution and its derivative can be used only if the trials are independent and
identical.
†
Discrete uniform. This distribution can be used to represent random occurrence with
several possible outcomes. A Bernoulli (1/2) and Discrete Uniform (DU) ð0; 1Þ are the
same.
†
Uniform distribution (continuous). This distribution is also called the rectangular distribu-
tion. It is considered one of the simplest distributions to use. It is commonly used if a
random variable is bounded and no further information is available. Examples include:
distance between source and destination of message on a network, and seek time on a disk.
In order to generate a continuous uniform distribution, Uða; bÞ, you need to: generate u ,
Uð0; 1Þ and return a ¼ðb 2 aÞu. The key parameters are: a ¼ lower limit and b ¼ upper
limit, where b . a. The continuous uniform distribution is used as a ‘first’ model for a
quantity that is felt to be randomly varying between two bonds a and b, but about which
little else is known.
†
Exponential distribution. This is considered the only continuous distribution with
memoryless property. It is very popular among performance evaluation analysts who
work in simulation of computer systems and networks as well as telecommunications. It
is often used to model the time interval between events that occur according to the Poisson
systems. It can also be used to model fatigue failure and ball bearing failure. It is consid-
ered the most widely used distribution to represent failure of all types. It is interesting to
point out that the exponential distribution is a special case of the Weibull distribution when
the shape parameter a is equal to 1.
†
Normal or Gaussian distribution. This is also called the bell distribution. It is used to
model errors of any type including modeling errors and instrumentation errors. Also, it has
been found that during the wearout phase, component lifetime follows a normal distribu-
tion. A normal distribution with zero mean and a standard deviation of 1 is called standard
normal distribution or a unit normal distribution. It is interesting to note that the sum of
large uniform variates has a normal distribution. This latter characteristic is used to
generate the normal variate, among other techniques such as the rejection and Polar
techniques. This distribution is very important in statistical applications due to the central
limit theorem, which states that under general assumptions, the mean of a sample of n
mutually independent random variables, that have distribution with finite mean and
variance, is normally distributed in the limit n ! 1.
†
Lognormal distribution: The log of a normal variate has a distribution called lognormal
distribution. This distribution is used to model errors that are a product of effects of a large
number of factors. The product of a large number of positive random variates tends to have
a distribution that can be approximated by lognormal.
†
Triangle distribution. As the name indicates, the pdf of this distribution is specified by
three parameters (a, b, c) that define the coordinates of the vertices of a triangle. It can be
used as a rough model in the absence of data.
†
Erlang distribution. This distribution is usually used in queuing models. It is used to model
service times in a queuing network system as well as to model the time to repair and time
between failures.
†
Number Generators (RNGs). The majority of programming languages have subroutines,
objects, or functions that generate random number sequences. The main requirements of
a random number generator are: (a) numbers produced must follow the uniform distri-
bution, since truly random events follow it; (b) the sequence of generated random
numbers produced must be reproducible (replicable) as long as the same seed is used,
which permits replication of simulation runs and facilitates debugging; (c) routines used
to generate random numbers must be fast and computationally efficient; (d) the routines
should be portable to different computer platforms and preferably to different program-
ming languages; (e) numbers produced must be statistically independent; (f) ideally, the
sequence produced must be nonrepeating for any desired length, however, this is imprac-
tical as the period must be very long; (g) the technique used should not require large
memory space; and (h) the period of the generated random sequences must be suffi-
ciently long before repeating themselves
The goal of a RNG is to generate a sequence of numbers between 0 and 1 which imitates
the ideal characteristics of uniform distribution and independence as closely as possible.
There are special tests that can be used to find out whether the generation scheme has
departed from the above goal. There are RNGs that have passed all available tests, therefore
these are recommended for use.
The algorithms that can be used to generate pseudorandom numbers are [1–4]: (a) linear
congruential generators; (b) midsquare technique; (c) Tausworthe technique; (d) extended
Fibonacci technique; and (e) combined technique.
13.4.1 Linear-Congruential Generators (LCG)
This is a widely used scheme to generate random number sequences. This technique was
initially proposed by Lehmer in 1951. In this technique, successive numbers in the sequence
are generated by the recursion relation:
X
n11
¼ðaX
n
1 bÞ mod m; for n $ 0
n
lie between 1 and (m 2 1), and any multiplicative LCG with a
period of (m 2 1) is called a full-period generator.
13.4.2 Midsquare Method
This method was developed by John Von Neumann in 1940. The scheme relies on the
following steps: (a) start with a seed value and square it; (b) use the middle digits of this
square as the second number in the sequence; (c) this second number is then squared and the
middle digits of this square are used as the third number of the sequence; and then (d) repeat
steps (a) to (d). Although this scheme is very simple, it has important drawbacks: (a) short
repeatability periods; (b) numbers produced may not pass randomness tests; and (c) if a 0 is
generated then all other numbers generated will be 0. The latter problem may become very
serious.
13.4.3 Tausworthe Method
This technique was developed by Tausworthe in 1965. The general form is:
b
n
¼ðC
q21
b
n21
Þ XOR ðC
q22
b
n22
Þ XOR
…
XOR ðC
0
b
n2q
randomness characteristics if their seed values are not selected carefully. Below are recom-
mended guidelines that should be followed when selecting the seed of a random number
generator [4]:
Wireless Networks352
†
Avoid using zero. Although a zero seed may be fine for mixed LCGs, it would make a
multiplicative LCG or Tausworthe generator stick at zero.
†
Do not use even values. If the generator is not a full-period generator such as multi-
plicative LCG with modulus m ¼ 2
k
, the seed should be odd. For other cases even values
are often as good as odd values. Avoid generators that have too many restrictions.
†
Never subdivide one stream. A common mistake is to use a single stream for all variables.
For example, if (r
1
; r
2
; r
3
; …) is the sequence generated using a single seed r
0
, the analyst
may for example, use r
1
to generate interarrival times, r
2
to generate service times, and so
forth. This may result in a strong correlation between the two variables.
follows:
1. Prepare a histogram of observed data.
2. Compare observed frequencies with those obtained from the specified density function.
3. For k cells, let O
i
¼ observed frequencies, E
i
¼ expected frequencies, then D ¼
Difference ¼
P
ðO
i
2 E
i
Þ
2
=E
i
.
4. For an exact fit D should be 0.
5. D can be shown to have a chi-square distribution with (K 2 1) degrees of freedom,
Simulation of Wireless Network Systems 353
where k is the number of cells (classes or clusters). We use the significance level a for
not rejecting or the confidence level (1 2 a) for accepting.
†
Kolmogorov–Smirnov (K-S) test. This test compares an empirical distribution function with
the distribution function, F, of the hypothesized distribution. It does not require grouping/
clustering of data into cells as in the chi-square test. Moreover, the K-S test is exact for any
sample size, n, while the chi-square test is only valid in an asymptotic sense. The K-S test
compares distribution of the set of numbers to a theoretical (uniform) distribution. The unit
where n is the number of numbers tested and j is the order of the number under test. If the
values of K2 and K1 are smaller than K
[12a,n]
listed in the K-S tables, the observations are
said to come from the specified distribution at the a level of significance.
†
Serial test. This test measures the degree of randomness between successive numbers in a
sequence. The procedure relies on generating a sequence of M consecutive sets of N
random numbers each. Then the numbers range is partitioned into K intervals. For each
group, construct an array of size (K £ K). The array is initialized by zeros. Then, the
sequence of numbers is examined from left to right, pairwise. If the left number of a pair is
in interval i, while the right number is in interval j, increment the (i,j) element by 1. After
this, the final results of M groups are compared with each other and with expected values
using the chi-square test.
†
Spectral test. This test is used to check for a flat spectrum by checking the observed
estimated cumulative spectral density function with the K-S test. Basically, it measures
the independence of adjacent sets of numbers.
†
Poker test. The poker test treats the random numbers grouped together as a poker hand.
The hands obtained are compared with what is expected using the chi-square technique.
For more detailed information on this, see Refs. [1–6,8]
13.6 Random Variate Generation
Random number generators are used to generate sequences of numbers that follow the
uniform distribution. However, in simulation we encounter other important distributions
such as exponential, Poisson, normal, gamma, Weibull, beta, etc. In general, most simulation
analysts use existing programming library routines or special routines built into simulation
languages. However, some programming languages do not have built-in procedures for all
distributions. Therefore, it is essential that the simulation analysts understand the techniques
2
l
x
; x $ 0
0; x , 0
(
The parameter l can be interpreted as the average number of arrivals (occurrences) per unit
time. It is equal to
l
¼ 1/
b
where
b
is interpreted as the mean interarrival time. We set the
CDF ¼ U ¼ 1 2 e
2
l
x
where U is uniformly distributed between 0 and 1.
X ¼ 2
1
l
lnð1 2 UÞ
Since U and (1 2 U) are both uniformly distributed between 0 and 1, we will use U instead of
(1 2 U) in order to reduce the computational complexity. Thus,
X ¼ 2
1
l
lnU
which is the required exponential random variate. The last expression is easy to implement
,F
3
,F
4
,…. The goal is to be able to sample
from F
i
more easily than F.
FðxÞ¼
X
p
i
F
i
ðxÞ
Moreover, this technique can be used if the probability density function f(x) can be expressed
as a weighted sum of other probability density functions.
f ðxÞ¼
X
p
i
f
i
ðxÞ
In both cases, the steps used for generation are basically the same: (a) generate a positive
random integer i such that PðI ¼ iÞ¼p
i
for i ¼ 1,2,3,…, which can be implemented using the
inverse transformation scheme; (b) return X with the ith CDF F
i
1
and Y
2
. This is why this
method is called the ‘Convolution Method.’
The convolution technique can be used to generate the Erlang, binomial, Pascal (sum of m
geometric variates), and triangular (sum of two uniform variates) distributions.
Wireless Networks356