chapter 2 review of literature 84 - inflibnet...

31
Chapter 2 Review of Literature 84 [153, 154, 155] Multicasting MDC video during multiple trees was primary discussed in CoopNetin the background of video multicast over peer-to-peer network to stop web servers from being besieged by great number of requests. CoopNet uses a central tree administration system, whereby each tree linkage is simply a sound link, consisting of some physical links, and as such, is very wasteful in wireless ad hoc networks. Thus the approach used in CoopNet are not appropriate for video multicast over wireless ad hoc networks. Author propose to watercourse multicast video over the Internet during multicast k-DAGs, which are Directed Acyclic graph in which every one recipient has k parents. Similar to the unicast case, by streaming video from multiple parents, losses among various paths are not correlated, reducing the burstiness of lost packets, therefore improving the effectiveness of FEC. The authors also present a rate allocation and packet partitioning algorithm to adjust sending rates from each parent based on the loss characteristics of each path, in order to minimize the overall loss at the receiver. [154, 155, 156, 157] The authors propose to transmit layered video coding over multiple paths in wireless ad hoc networks. In their scheme, base layer and enhancement layer packets are transmitted over different paths. Base layer packets are protected by automatic repeat request (ARQ). A lost base layer packet is retransmitted through the path where enhancement layer packets are transmitted. The authors propose to transmit different MDC sub streams over different paths in wireless ad hoc networks. The authors compare the performance of transmitting MDC video and layered coding video over multiple paths. They conclude that when retransmission is not allowed, MDC outperforms layered coding. When retransmission is allowed, if the loss rate in two paths are similar, performance of MDC is similar to that of layered coding with ARQ, and when the loss rate of two paths are different, performance of MDC is worse than that of layered coding with ARQ. [158, 159, 160, 161] expand a congestion-optimized multipath direction-finding algorithm, which finds manifold routes and performs best traffic partition to minimize a global congestion compute. offer a distributed algorithm to get congestion-minimized multipath routing. Advise a rate allocation scheme to optimize the likely received video

Upload: others

Post on 28-Nov-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 2 Review of Literature 84

[153, 154, 155] Multicasting MDC video during multiple trees was primary

discussed in CoopNetin the background of video multicast over peer-to-peer network to

stop web servers from being besieged by great number of requests. CoopNet uses a

central tree administration system, whereby each tree linkage is simply a sound link,

consisting of some physical links, and as such, is very wasteful in wireless ad hoc

networks. Thus the approach used in CoopNet are not appropriate for video multicast

over wireless ad hoc networks. Author propose to watercourse multicast video over the

Internet during multicast k-DAGs, which are Directed Acyclic graph in which every one

recipient has k parents. Similar to the unicast case, by streaming video from multiple

parents, losses among various paths are not correlated, reducing the burstiness of lost

packets, therefore improving the effectiveness of FEC. The authors also present a rate

allocation and packet partitioning algorithm to adjust sending rates from each parent

based on the loss characteristics of each path, in order to minimize the overall loss at the

receiver.

[154, 155, 156, 157] The authors propose to transmit layered video coding over

multiple paths in wireless ad hoc networks. In their scheme, base layer and enhancement

layer packets are transmitted over different paths. Base layer packets are protected by

automatic repeat request (ARQ). A lost base layer packet is retransmitted through the

path where enhancement layer packets are transmitted. The authors propose to transmit

different MDC sub streams over different paths in wireless ad hoc networks. The authors

compare the performance of transmitting MDC video and layered coding video over

multiple paths. They conclude that when retransmission is not allowed, MDC

outperforms layered coding. When retransmission is allowed, if the loss rate in two paths

are similar, performance of MDC is similar to that of layered coding with ARQ, and

when the loss rate of two paths are different, performance of MDC is worse than that of

layered coding with ARQ.

[158, 159, 160, 161] expand a congestion-optimized multipath direction-finding

algorithm, which finds manifold routes and performs best traffic partition to minimize a

global congestion compute. offer a distributed algorithm to get congestion-minimized

multipath routing. Advise a rate allocation scheme to optimize the likely received video

Page 2: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 2 Review of Literature 85

quality base on models of encoder's rate-distortion recital and network's rate-congestion

tradeoffs. Though the traffic replica used in the above ID assumes that all nodes transmit

simultaneously, and the ability of each link is determined by the sign meddling Noise

Ratio (SINR). This model is dissimilar from the flow model decided by 802.11 MAC

layer protocols, which is typically used in wireless ad hoc networks.

[162, 164, 165] Propose to distribute layered coding over multiple paths in

wireless ad hoc networks. The authors give base layer packets higher priority over

enhancement layer packets to improve the overall system performance. Try to enhance

low latency video communication over wireless LANs by sending video through multiple

Access Points (AP). They exploit the schemes which use multiple paths simultaneously

or switch between multiple paths based on channel condition. Propose a fine-grained

client-specific path selection scheme among a set of neighboring APs. The scheme

attempts to choose an AP based on short-term frame delivery statistics, with the goal of

adapting to short-term variations using path diversity.

[163] The authors propose a genetic algorithm based solution for multiple tree

multicast streaming over wireless ad hoc networks, assuming that (a) they obtain each

link's characteristics, and (b) consecutive links' packet loss rates are independent. The

proposed scheme in is too complicated to implement in practice.

[166] A cross-layer small package scheduling scheme that streams pre-encoded

video over wireless downlink small package access networks to multiple user is

presented. The scheme can exist used with the up-and-coming wireless standards such as

HSDPA and IEEE 802.16. A gradient based preparation scheme is used in which user

data rates are dynamically familiar based on channel quality as well as the gradients of a

utility function. The user utilities are designed as a occupation of the distortion of the

received video. This enable distortion-aware packet scheduling both within and across

multiple users. The usefulness takes into account decoder error concealment, an

important component in deciding the received excellence of the video. They consider

both simple and complex blunder concealment techniques. imitation results show that the

gradient based scheduling structure combined with the content aware utility functions

provides a viable method for downlink packet development as it can significantly

Page 3: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 2 Review of Literature 86

outperform current content-independent technique. Further tests determine the sensitivity

of the scheme to the initial video encoding schemes, as well as to non-real-time small

wrap up order technique.

[167] In wireless sensor networks, one of the main design challenges is to save

severely constrained energy resources and obtain long system lifetime. Low cost of

sensors enables us to randomly deploy a large number of sensor nodes. Thus, a potential

approach to solve lifetime problem arises. That is to let sensors work alternatively by

identifying redundant nodes in high-density networks and assigning them an off-duty

operation mode that has lower energy consumption than the normal on-duty mode. In a

single wireless sensor network, sensors are performing two operations: sensing and

communication. Therefore, there might exist two kinds of redundancy in the network.

Therefore, in this paper, they enhance to support general wireless sensor networks by

proving another conclusion: ‘‘the communication range is twice of the sensing range’’ is

the sufficient condition and the tight lower bound to ensure that complete coverage

preservation implies connectivity among active nodes if the original network topology is

connected. Also, we extend the result to k-degree network connectivity and k-degree

coverage preservation.

[168] When determined for dependability, multicast protocols are most usually

designed as deterministic solutions. Such an move toward seem to make the way of

thinking about dependability guarantee in the face of small tie together losses and/or node

crash. It is but closely this determinism that tend to befall a limiting factor when aiming

at both consistency and scalability, chiefly in highly dynamic network, e.g., ad hoc

networks. talk based multicast protocol come into view to be a viable path towards as

long as multicast reliability guarantees. Such procedure hugs the non-deterministic

natural world of ad hoc networks, as long as logically unsurprising probabilistic

dependability guarantees at a sensible in the clouds. The Route Driven Gossip (RDG)

procedure, a gossip-based multicast procedure intended exactly to get together a extra

practical specification of probabilistic reliability in ad hoc networks. RDG protocol can

be deployed on any basic on-demand routing protocol, achieving a high level of

reliability without relying on any inherent multicast primitive. They illustrate our RDG

Page 4: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 2 Review of Literature 87

protocol by layering it on top of the ‘‘bare’’ Dynamic Source Routing protocol, and

convey our claims of reliability and scalability through both analysis and simulation.

[169] While the use of physical carrier sensing for medium access control in ad

hoc wireless networks is well established, exploiting physical carrier sensing directly for

network layer functions is largely unexplored. They conduct extensive simulation

evaluations of recently proposed algorithms that directly exploit physical carrier sensing

for backbone network (spanner) construction, broadcast, and convergecast in wireless ad

hoc networks. Their algorithms accommodate interference ranges larger than

transmission ranges, explicitly incorporate the medium access control and packet

collisions, and do not require any prior knowledge of the network. For spanner

construction, their algorithms include three self stabilizing phases that establish leader

nodes able to reach all nodes in one hop, assign the leaders non-interfering transmission

rounds, and connect the leaders through gateway nodes.

[170] Ad hoc networks are collections of mobile nodes communicating using

wireless media without any fixed infrastructure. Existing multicast protocols fall short in

a harsh ad hoc mobile environment, since node mobility causes conventional multicast

trees to rapidly become outdated. This paper explores these contrasting issues and

proposes PPMA, a Probabilistic Predictive Multicast Algorithm for ad hoc networks, that

leverages the tree delivery structure for multicasting, solving its drawbacks in terms of

lack of robustness and reliability in highly mobile environments. PPMA overcomes the

existing trade-off between the bandwidth efficiency to set up a multicast tree, and the tree

robustness to node energy consumption and mobility, by decoupling tree efficiency from

mobility robustness. By exploiting the non deterministic nature of ad hoc networks, the

proposed algorithm takes into account the estimated network state evolution in terms of

node residual energy, link availability and node mobility forecast, in order to maximize

the multicast tree lifetime, and consequently reduce the number of costly tree

reconfigurations. The algorithm statistically tracks the relative movements among nodes

to capture the dynamics in the ad hoc network. This way, PPMA estimates the node

future relative positions in order to calculate a long-lasting multicast tree.

Page 5: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 2 Review of Literature 88

[171] The QoS solution for video broadcast over IP network currently include

included services (IntServ), DiffServ, multiprotocol tag switching (MPLS). amongst

them, the DiffServ is regard as a leading protocol for its suppleness, scalability, and

ability of QoS assurance. usually, policing or warning function was apply in DiffServ by

using srTCM (single-rate three color marker) and trTCM (two-rate three color marker).

future system improve the throughput of MPEG4 video transmission over IP system. In

this system, I-frames, P-frames and B-frames are noticeable as dissimilar repair priorities

according to broadcast state and their payment to the obvious image fineness.

Investigators used genuine MPEG4 video traffic traces to compare the performance of the

future system with additional obtainable RFCs for MPEG video transmission, such as

srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

the throughput of video transmission over IP network.

[172] There are many research papers with the performance evaluation of Adhoc

network protocols but they use different metrics to evaluate their results instead of nodes

mobility and nodes velocity some of them. The authors investigate the performance of

TCP of various (single-hop and multi-hop) routing protocols for mobile ad hoc networks.

Using ns-2, here the Authors evaluate the TCP window size, throughput and packet delay

over a single TCP connection. And there results shows that the various performance

metrics are tightly related, and that TCP performance is tightly coupled with the stability

and length of the routing path of each routing protocol. A variety of routing protocols

have been proposed for Mobile Ad-Hoc Networks. However, little attention has been

paid to study the performance of TCP traffic over these protocols. Therefore the authors

investigate the performance of TCP over multi hop routing protocols using simulations in

ns-2 for a range of node mobility with a single traffic source. The performance metrics

that they considered include TCP window size, throughput and packet delay. Based on

numerical results, they show that TCP performance is tightly coupled with the stability

and length of routing paths. Therefore they plan to investigate TCP performance of

routing protocols with multiple traffic sources.

[174] The Authors show that the Adhoc networks present challenge to TCP’s

congestion manage mechanism related to its incapability of unique between losses

Page 6: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 2 Review of Literature 89

induced by overcrowding and others types of losses. There are frequent articles to

contract with this subject that can be generally categorize to either end-system base or

network-assisted. In this thesis the author present a summing up of those article with

accent on their characteristic characteristics. The writer of the paper also there the

presentation study of an end-system based device that perform exact discovery of system

state by measure suitable metrics.

[173] They evaluate its performance under variety of network conditions running

different class of routing protocols DSR (reactive) and DSDV (proactive). Their

performance study shows the effect of different factors in isolation and in combination

with each other on the TCP performance, and the impact of routing protocol design

approaches in the TCP stability.

[175] The authors discussed the impact of AODV and DSDV routing protocols

on the TCP through put, delay and drop rate performance. Their Extensive simulation

results and analysis showed that TCP has better performance over AODV than over

DSDV and has more stable performance in SN mobility than in RW mobility. Therefore

they suggest using more mobility models, in particular, such as SN, in the evaluations of

the transport layer or routing layer protocols because the mobility patterns have impacts

on the protocol performance. In this work, they evaluate the TCP performance including

the good put, delay and drop rate over AODV or DSDV routing protocol in Random

Waypoint mobility model and in Social Network mobility model. Extensive simulation

results and analysis showed that the TCP performance is better over AODV than over

DSDV because of its higher good put, lower drop rate and is more stable in different

mobile host speed scenarios, in the scenarios generated by both Social Network mobility

model and Random Waypoint mobility model.

[176] The authors evaluate AODV and OLSR presentation in practical urban

scenario. They studied that procedure under unreliable metrics such as node mobility and

vehicle solidity, and with changeable transfer rates and demonstrate that cluster effects

created by cars aggregate at intersections have remarkable impacts on evaluation and

performance metrics. They give a qualitative appraisal of the applicability of the

Page 7: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 2 Review of Literature 90

procedure in dissimilar vehicular situation. In this paper, they assess the presentation of

AODV and OLSR for vehicular ad hoc networks in city surroundings.

Page 8: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 91

CHAPTER 3

MATERIALS & METHODS

3.1 Introduction to Network Simulator 2 (NS2)

Network Simulator (Version 2), widely identified as NS2, is simply an affair

single-minded imitation tool that has proved helpful in studying the lively natural history

of message networks. Simulation of wired as well as wireless network purpose and

protocols e.g., routing algorithms, TCP, UDP can be complete using NS2. In universal,

NS2 provides users with a method of specify such system protocols and replicate their

matching behaviors.

Outstanding to its flexibility and modular nature, NS2 has gained steady status in

the networking investigate group of people since its birth in 1989. Ever as, more than a

small number of revolutions and revision have marked the rising adulthood of the

appliance. Surrounded by these are the further education college of California and

Cornell University who developed the REAL complex simulator, the foundation which

NS is based on. Since 1995 the Defense Advanced Research Projects Agency (DARPA)

supported expansion of NS from first to last the Virtual InterNetwork Testbed (VINT)

development [180]. At this time the National Science base (NSF) has joined the ride in

growth. Last but not the smallest amount, the collection of researchers and developers in

the group of people are constantly operational to stay NS2 burly and adaptable.

3.2 Basic Architecture

Figure 3.1 shows the essential structural design of NS. NS2 provides users with

executable command ns which get on input quarrel, the name of a Tcl imitation scripting

file. Users are nourishing the name of a Tcl simulation script which sets up a simulation

as an contribution argument of an NS2 executable authority ns. In most luggage, a

imitation draw file is created, and is used to plan chart and/or to make cartoon.

Page 9: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 92

NS2 consists of two key verbal communications: C++ and Object-oriented Tool

Command Language (OTcl). While the C++ defines the internal mechanism of the

replication objects, the OTcl sets up imitation by bring together and configuring the

objects as healthy as scheduling separate actions. The C++ and the OTcl are linked

jointly using TclCL. Mapped to a C++ object, variables in the OTcl domains are each so

often referred to as handles. Conceptually, a hold is just a cord in the OTcl area, and does

not hold any functionality. In its place, the functionality is defined in the map C++ object

e.g., of class Connector. In the OTcl domain, a switch acts as a frontend which work

together with users and other OTcl objects. It may describe its own events and variables

to facilitate the communication. Note that the associate procedures and variables in the

OTcl area are called example events (instprocs) and example variables (instvars),

respectively.

Simulation

Trace

File

Figure 3.1 Basic architecture of NS

NS2 provide a large number of built-in C++ objects. It is sensible to use these

C++ objects to set up a imitation using a Tcl simulation script. though, go forward users

might find these substance inadequate. They need to expand their own C++ objects, and

use a OTcl pattern interface to put jointly these substance.

TclCL

C++ OTclNS2 Shell Executable Command (ns)

SimulationObjects

SimulationObjects

Tcl

SimulationScript

NAM(Animation

)

Xgraph(Plotting)

Page 10: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 93

After reproduction, NS2 outputs moreover text-based or animation-based

reproduction results. To take to mean these results graphically and interactively, tools

such as NAM (Network AniMator) and XGraph are used. To consider a particular

activity of the set of connections, users can remove a relevant separation of text-based

information and change it to a more imaginable appearance.

3.3 Installation of NS2

NS2 is a free simulation tool, which can be obtained from [177]. It runs on

various platforms including UNIX, Windows, and Mac systems. Being developed in the

Unix environment, with no surprise, NS2 has the smoothest ride there, and so does its

installation. Unless otherwise specified, it is based on a Cygwin UNIX emulator activated

Windows system.

NS2 basis codes are dispersed in two forms: the all-in-one suite and the

component-wise. With the all-in-one wrap up, users get all the necessary mechanism

along with a number of optional mechanisms. This is on the whole a optional choice for

the beginners. This wrap up provides an install script which configures the NS2

surroundings and creates NS2 executable file using the make utility.

The current all-in-one suite consists of the following major mechanism:

• NS release 2.29,

• Tcl/Tk release 8.4.11,

• OTcl release 1.11, and

• TclCL release 1.17.

The following are the optional components:

• NAM release 1.11: NAM is an animation tool for viewing network simulation traces

and packet traces.

• Zlib version 1.2.3: This is the required library for NAM.

• Xgraph version 12.1: This is a data plotter with interactive buttons for panning,

zooming, printing, and selecting display options.

Page 11: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 94

3.3.1 Installing an All-In-One NS2 Suite on Unix-Based Systems

The all-in-one set can be put in the Unix-based equipment by just running the set

up script and next the directions therein. The only prerequisite is a central processing unit

with a C++ compiler install. The following orders show how the all-in-one NS2 set can

be installed and validated, respectively:

shell>./install

shell>./validate

Validating NS2 involves simply running a number of working scripts that verify the

essential functionalities of the installed components.

3.3.2 Installing an All-In-One NS2 Suite on Windows-Based Systems

To sprint NS2 on Windows-based in service systems, a bit of change is necessary.

on the whole, the thought is to make Windows based machines imitate the functionality

of the Unix-like situation. A popular agenda that do this job is Cygwin. After in receipt of

Cygwin to work, the same modus operandi as that of Unix-based fitting can be hunt. For

ease of fixing, it is optional that the all-in-one pack up be used. The complete report of

Windows-based put in can be start online at NS2’s Wiki site [177].

Note that by default Cygwin does not install all packages necessary to run NS2. A

user needs to manually install the addition packages shown in Table 3.1

Table 3.1 Additional Cygwin packages required to run NS2.

Category Packages

Development gcc, gcc-objc, gcc-g++, make

Utils Patch

X11 xorg-x11-base, xorg-x11-devel

3.4 Directories and Convention

3.4.1 Directories

Suppose that NS2 is installed in directory nsallinone-2.29. Figure 3.2 shows the

directory structure under directory nsallinone-2.29. Here, directory nsallinone-2.29 is on

Page 12: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 95

the Level 1. On the Level 2, directory tclcl-1.17 contains classes in TclCL (e.g., Tcl,

TclObject, TclClass). All NS2 simulation modules are in directory ns-2.29 on the Level

2. Hereafter, we will refer to directories ns-2.29 and tclcl-1.18 as

C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\ns-2.29 and

C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-1.17, respectively.

.....

…….

Figure 3.2 Directory Structure of NS2

On Level 3, the module in the interpret hierarchy are under book tcl. Among these unit,

the frequently-used ones e.g., ns-lib.tcl, ns-node.tcl, ns-link.tcl are lay up under directory

lib on Level 4. simulation module in the compile pecking order are classified in directory

on Level 2. For instance, an index tool contains various assistant lessons such as chance

changeable producer. index common contain basic unit related to packet forward such as

the simulator, the scheduler, connector, small package. index line, tcp, and trace contain

modules for line, TCP “Transmission Control Protocol”, and tracing, in that order.

nsallinone-2.30

ns-2.30 tcl8.4.13 tclcl-1.18

TclCLClasses

All NS2SimulationModules

common tools tcp queue trace tcl

Level 1

Modules in

Interpreted

hierarchy

Level 2

Level 3

lib rtglib

Commonly used modules inthe interpreted hierarchy

Level 4

Page 13: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 96

3.4.2 Convention

The terminologies and formats which are used in NS2 and in this Chapter

hereafter are shown below:

Terminology

• An NS2 recreation script e.g., myfirstns.tcl is referred to as a Tcl simulation script .

• C++ and OTcl class hierarchies, which comprise one-to-one communication, are

referred to as the amass pecking order and the interpreted hierarchy, in that order.

Class or member variables and class or member function are the variables and

function which fit in to a class. In the compile pecking arrange, they are referred to

just as variables and purpose, in that order. Those in the interpret pecking arrange are

referred to as example variables “instvars” and instance procedures “instprocs”, in

that order. As we will see in Section 3.13.4, command, is a special example process,

whose completion is in the amass pecking order i.e., written in C++. An OTcl thing

is, so, linked with instance variables, example events, and instructions, while a C++

object is linked with variables and purpose.

• In spite of their slight dissimilarity, the terms “OTcl” and “interpreted” are used

interchangeably all through the part. Likewise, “C++” and “compiled” are used

interchangeably. These provisions can be used as adjectives to point toward the locale

in idea. For case, both OTcl variables and take variables pass on to variables in the

construe ladder. also, both C++ functions and compiled functions refer to functions in

the compiled hierarchy. Also, we will pass on to the C++ compiler and the OTcl

interpreter basically as the compiler and the predictor, in that order.

• A “MyFirstClass” thing is shorthand for an entity of class MyFirstClass. A

“MyFirstClass” pole is a shorthand for a indicator which point to an objective of class

MyFirstClass. For illustration, based on the statement “Queue q” and “Packet pointer

p”, “q” and “p” are said to be a “Queue” object and a “small package pointer”, in that

order. Also, presume further that group of students DerivedClass and AnotherClass

derive as of class MyFirstClass. Then, the word a MyFirstClass object refers to

Page 14: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 97

anything which is instantiated from class MyFirstClass or its resulting classes (i.e.,

DerivedClass or AnotherClass).

• Objects and instance are instantiated from a C++ class and an OTcl class, in that

order.

• NS2 consists of two language. presume that objects “A” and “B” are written in each

verbal communiqué and write to one more. Then, “A” is said to be the shadow object

of “B”. likewise “B” is said to be the shadow object of “A”.

• Consider two consecutive nodes in Figure 3.6. In this configuration, an object (i.e.,

node) on the left always sends packets to the object on the right. The object on the

right is referred to as a downstream object or a target, while the object on the right is

referred to as an upstream object. In a general case, an object can have more than one

target. However, a packet must be forwarded to one of these targets. From the

perspective of an upstream object, a downstream object which receive the packet is

also referred to as a forwarding object.

Notations

As in C++, we use “::” to indicate the scope of functions and instprocs.

NS2 rules are written in “Times new Roman font type”. The passage marks are

misplaced if it is clear from the background. For instance, the Simulator is a universal

word for the replicate unit in NS2, as a Simulator thing is an thing of class Simulator.

A value contained in a variable is embraced with <>. For example, if a variable var

stores an integer 10, <var> will be 10.

A command prompt or an NS2 prompt is denoted by “>>” at the beginning of a line.

A class name may consist of several words. All the words in a class name are as we

follow in C++. In the interpreted hierarchy, a derived class is named by having the

name of its parent class and a slash character (“/”) as a prefix, while that in the

compiled hierarchy is named by having the name of its base class as a suffix. Naming

Convention are given in Table 3.2.

In the understand pecking order, an teach name is on paper as we follow in C++ i.e.

lower-case. If the teach name consists of more than one word, each utterance apart

Page 15: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 98

from for the primary one will be capitalized now that we use in container of oops

verbal communication like C++. In the amass pecking order, all the language are on

paper in inferior container and alienated by an underline “_” mention in table 3.2.

The naming convention for variables is similar to that for functions and instprocs.

Table 3.2 Examples of NS2 naming convention

The Interpreted hierarchy The compiled hierarchy

Base class Agent Agent

Derived Class Agent/TCP TcpAgent

Derived Class(2nd Level) Agent/Tcp/Reno RenoTcpAgent

Class Functions installNext install_next

Class Variables windowOption Wnd_option

3.5 Running NS2 Simulation

3.5.1 NS2 Program Invocation

After the installation or recompilation, an executable file ns is shaped in the NS2

home list. NS2 can be call upon by carry out the next statement as of the shell setting:

>> ns [<filename>] [<argslist>]

where <filename> and <argslist> are non-compulsory input disagreement. If no

disagreement is given, the domination will bring up an NS2 atmosphere, where NS2

waits to construe commands from the normal input line-by-line. If the first contribution

quarrel <filename> is given, NS2 will interpreted the input scripting <filename> means

Tcl simulation script according to the Tcl syntax. lastly, the input influence <argslist>,

each alienated by a pallid room, are fed to the Tcl file <filename>. From inside the file

<filename>, the contribution quarrel is store in the fitted changeable argv.

3.5.2 Main NS2 Simulation Steps

The followings show the three key step guideline in defining a simulation

scenario in a NS2:

Page 16: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 99

Step 1: Simulation Design

The first step in simulating a network is to design the simulation. In this step, the

users should determine the simulation purposes, network configuration and assumptions,

the performance measures, and the type of expected results.

Step 2: Configuring and Running Simulation

This step equipment the mean in the first footstep. It consists of two phase:

System pattern stage: In this stage system workings (e.g., node, TCP and UDP) are

twisted and configured according to the simulation plan. Also, the proceedings such

as information move are listed to create at a sure occasion.

Simulation stage: This stage starts the simulation which was configured in the system

pattern Phase. It uphold the simulation timepiece and execute events chronologically.

This phase more often than not runs until the simulation timepiece reach a doorsill

value particular in the system pattern Phase.

In most cases, it is suitable to define a simulation situation in a Tcl scripting file (e.g.,

<filename>) and nourish the file as an sum dispute of an NS2 spell.

Step 3: Post Simulation Processing

The main tasks in this steps include verifying the integrity of the program and

evaluating the performance of the simulated network. While the first task is referred to as

debugging, the second one is achieved by properly collecting and compiling simulation

results.

3.6 A Simulation Example

We demonstrate a network simulation through a simple example. Again, a

simulation process consists of three steps.

Step 1: Simulation Design

Figure 3.3 shows the configuration of a network under consideration. The

network consists of five nodes n0 to n4. In this scenario, node n0 sends constant bit- rate

(CBR) traffic to node n3, and node n1 transfers data to node n4 using

Page 17: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 100

Node

Application

Transport Agent

Data Flow

Figure 3.3 A simple network topology.

a file transfer protocol (FTP). These two carried traffic sources are carried by transport

layer protocols User Datagram Protocol (UDP) and Transmission Control Protocol

(TCP), respectively. In NS2, the transmitting object of these two protocols are a UDP

agent and a TCP agent, while the receivers are a Null agent and a TCP sink agent,

respectively.

Step 2: Configuring and Running Simulation

Programs 3.1–3.2 show two portions of a Tcl simulation script which implements

the scenario in Figure 3.3.

Consider Program 3.1. This program creates a simulator instance in Line 3. It

creates a trace file and a NAM trace file in Lines 5 – 6 and 8 – 9, respectively. It defines

function finish() in Lines 11 – 18. Finally, it creates nodes and links them together in

Lines 20 – 24 and 26 – 31, respectively.

The Simulator is shaped in Line 3 by put into practice “new Simulator”. The go

back Simulator switch is stock up in a up-and-down ns. Lines 5 and 8 open files amount

produced.tr and output.nam, in that order, for writing. The variables my trace and

CBR

UDPAgent

TCPAgent

FTP

n0

n1

11

n2n4

n3

TCPSink

NULLAgent

Page 18: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 101

my_NAM are the dossier feel for these two records, in that order. Lines 6 and 9 update

NS2 to amass all sketch in classify for a typical draw and a NAM trace, in that sort.

The procedure finish() is invoked right away previous to the simulation terminate.

The keyword worldwide informs the Tcl predictor that the variables ns, my_trace,

my_NAM are those defined in the international scope. Line 13 flushes the shock absorber

of the small package tracing variables. Lines 14 – 15 close the file linked with handle

my_trace and my_NAM. Line 16 executes the announcement “nam output.nam &” from

the shell surroundings. to bring to a close, Line 17 tells NS2 to outlet with code 0.

Lines 20 – 24 create Nodes using the instproc swelling of the Simulator whose

lever is ns. Lines 26 – 30 fix each pair of nodes by a bi-directional link by an instproc

duplex-link of class Simulator, where src is a start node, dst is an end node, bw is the link

bandwidth, delay is the link spread delay, and qtype is the type of the queues flanked by

the node src and the node dst. alike to the instproc duplex-link, row 30 create a uni-

directional connection using an instproc simplex-link of group of students Simulator.

lastly, Line 31 sets the line dimension of the line up flanked by node n2 and lump n3 to

be 60 packets.

Next, think the second piece of the Tcl simulation script in agenda 3.2. A UDP

link, a CBR traffic source, a TCP link, and an FTP sitting are created and configured in

Lines 25–30, 31–34, 35–40, and 41–42, in that order. Lines 43–47 schedules separate

events. lastly, the simulator is started in Line 48 using the instproc run() linked with the

simulator grip ns.

To make a UDP link, a sender udp and a handset null are shaped in Lines 32 and

34, in that order. Taking a node and an manager as contribution argument, an instproc

attach-agent of class Simulator in Line 33 attaches a UDP agent udp and a node n0

together. Similarly, Line 35 attaches a Null agent null to a node n3.

Program 3.1 My First NS2 Program

1 # firstns.tcl

2 # Create a Simulator

3 set ns [new Simulator]

Page 19: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 102

4 # Create a trace file

5 set mytrace [open output.tr w]

6 $ns trace-all $my_trace

7 # Create a NAM trace file

8 set myNAM [open output.nam w]

9 $ns namtrace-all $my_NAM

10 # Define a procedure finish

11 proc finish { } {

12 global ns my_trace my_NAM

13 $ns flush-trace

14 close $my_trace

15 close $my_NAM

16 exec nam output.nam &

17 exit 0

18 }

19 # Create Nodes

20 set n0 [$ns node]

21 set n1 [$ns node]

22 set n2 [$ns node]

23 set n3 [$ns node]

24 set n4 [$ns node]

25 # Connect Nodes with Links

26 $ns duplex-link $n0 $n2 150Mb 10ms DropTail

27 $ns duplex-link $n1 $n2 150Mb 10ms DropTail

28 $ns duplex-link $n2 $n4 60Mb 15ms DropTail

29 $ns duplex-link $n2 $n3 60Mb 15ms DropTail

30 $ns simplex-link $n3 $n4 20Mb 20ms DropTail

31 $ns queue-limit $n2 $n3 60

Page 20: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 103

The instproc connect in Line 36 informs an agent fromagt to send the generated traffic to

an agent toagt. Finally, Line 37 sets the UDP flow ID to be 1. The construction of a TCP

connection in Lines 42 – 47 is similar to that of a UDP connection in Lines 32 – 37.

Program 3.2 First NS2 Program (Continued)

32 set udp [new Agent/UDP]

33 $ns attach-agent $n0 $udp

34 set null [new Agent/Null]

35 $ns attach-agent $n3 $null

36 $ns connect $udp $null

37 $udp set flowid_ 1

# Create a CBR traffic source

38 set cbr [new Application/Traffic/CBR]

39 $cbr attach-agent $udp

40 $cbr set packetSize_ 1000

41 $cbr set rate_ 2Mb

# Create a TCP agent

42 set tcp [new Agent/TCP]

43 $ns attach-agent $n1 $tcp

44 set sink [new Agent/TCPSink]

45 $ns attach-agent $n4 $sink

46 $ns connect $tcp $sink

47 $tcp set flowid_ 2

# Create an FTP session

48 set ftp [new Application/FTP]

49 $ftp attach-agent $tcp

Page 21: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 104

# Schedule events

50 $ns at 0.1 "$ftp start"

51 $ns at 0.15 "$cbr start"

52 $ns at 80.0 "$ftp stop"

53 $ns at 80.5 "$cbr stop"

54 $ns at 81 "finish"

# Start the simulation

55 $ns run

A CBR transfer source is created in Line 38. It is fond of to a UDP negotiator udp

in Line 39. The sachet size and cohort rate of the CBR link are set to 1000 bytes and 2

Mbps, respectively. likewise, an FTP sitting grip is created in Line 48 and is emotionally

involved to a TCP manager tcp in Line 49.

In NS2, separate events can be listed using an instproc at of class Simulator,

which takes two say arguments: time and str. This instproc calendar an completing of str

when the reproduction time is occasion. Lines 50 and 51 start the FTP and CBR travel at

1st second and 1.5st second, in that order. Lines 52 and 53 stop the FTP and CBR traffic

at 80.0th next and 80.5th second, in that order. Line 54 terminates the simulation by

invoking the process finish() at 81st next. Note that the FTP and CBR traffic basis can be

started and stopped up by appeal to its commands create () and discontinue (), in that

order.

We run the above simulation script by executing

>>ns myfirst_ns.tcl

from the shell environment. At the end of simulation, the trace files should be created and

NAM should be running.

Step 3: Post Simulation Processing–Packet Tracing

Packet tracing records the detail of packet flow during a simulation. It can be

classified into a text-based packet tracing and a NAM packet tracing.

Page 22: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 105

Text-based packet tracing records the detail of packets passing through network

checkpoints (e.g., nodes and queues). A part of the text-based trace obtained by running

the above simulation (firstns.tcl) is shown below.

+ 0.004095 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 0 0

- 0.004095 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 0 0

r 0.006279 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 0 0

+ 0.006795 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 1 1

- 0.006795 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 1 1

r 0.008979 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 1 1

+ 0.009856 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 2 2

- 0.009856 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 2 2

r 0.01204 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 2 2

+ 0.013606 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 3 3

- 0.013606 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 3 3

r 0.01579 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 3 3

+ 0.017356 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 4 4

- 0.017356 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 4 4

r 0.01954 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 4 4

+ 0.021106 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 5 5

- 0.021106 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 5 5

r 0.02329 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 5 5

+ 0.024856 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 6 6

- 0.024856 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 6 6

r 0.02704 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 6 6

+ 0.028606 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 7 7

- 0.028606 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 7 7

r 0.03079 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 7 7

+ 0.032356 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 8 8

- 0.032356 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 8 8

r 0.03454 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 8 8

Page 23: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 106

+ 0.036106 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 9 9

- 0.036106 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 9 9

r 0.03829 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 9 9

+ 0.039856 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 10 10

- 0.039856 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 10 10

r 0.04204 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 10 10

+ 0.043606 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 11 11

- 0.043606 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 11 11

r 0.04579 1 0 cbr 230 ------- 0 1.0.1.0 0.0.0.0 11 11

...

Figure 3.4 shows the format of each trace line, which consists of 12 columns. The

general arrangement of each outline line is revealed in Figure. 3.4, where 12 column craft

up a entire trace line. The type identifier ground corresponds to four likely affair types

that a small package has knowledgeable: r (received), + (enqueued), - (dequeued), and d

(dropped). The time field indicate the time at which occasion occurs. Fields 3 and 4 are

the preliminary and the end nodes, in that order, of the link at which a sure event get

place. Fields 5 and 6 are pack type and pack size, in that order. The next pasture is a run

of garland, representative any atypical actions. memo the yield “---------” denote no flag.

next the flags is a pack flow ID. Fields 9 and 10 blot the cause and the end talk to, in that

order, in the form of knob. Port. For exact packet congregation at the end node, NS also

specifies a pack run number in the second final field. to finish, to keep track of all carton,

a packet single ID is recorded in the final field.

1 2 3 4 5 6 7 8 9 10 11 12

Type

Identifier

Time Source

Node

Destination

Node

Packet

Name

Packet

Size

Flags Flow

ID

Source

Address

Destination

Address

Sequence

Number

Packet

Unique

ID

Figure 3.4 Format of each line in a normal trace file.

Now, have this draw at hand would not be useful unless significant analysis is do

on the data. In post-simulation analysis, one more often than not extracts a subset of the

Page 24: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 107

information of interest and further analyzes it. For instance, the average throughput

linked with a specific link can be computed by take out only the article and fields

associated to that connection from the trace file. Two of the bulk popular language that

make easy this procedure are AWK and Perl.

Text-based packet tracing is activated by executing “$ns trace-all $file”, where ns

is the Simulator handle and file is a handle associated with the file which stores the

tracing text. This statement simply informs NS2 of the need to trace packets. When an

object is created, a tracing object is also created to collect the detail of traversing packets.

Hence, the “trace-all” statement must be executed prior to object creation.

3.7 Network AniMation (NAM) Trace

NAM trace is records imitation feature in a text file, and uses the text file the play

back the simulation using cartoon. NAM trace is set in motion by the authority “$ns

namtrace-all $file”, where ns is the Simulator grip and file is a switch related with the file

(e.g., output.nam in the above example) which food the NAM trace in order. After obtain

a NAM trace file, the cartoon can be initiated directly at the authority prompt from side to

side the following authority.

>>nam filename.nam

A lot of dream skin are obtainable in NAM. These skin are for instance animate

tinted small package flow, exhausted and plummeting nodes, classification nodes at a

particular instant, determining the nodes, complexion a exact link, and check a line.

3.8 Including C++ Modules into NS2 and the make Utility

In rising an NS2 simulation, very frequently it is necessary to make the

customized C++ modules to balance the existing libraries. As such, the developer is

countenance with the job of keeping path of all the created files as a part of NS2. When a

modify is made to one file, characteristically it requires recompilation of some other files

that depend on it. blue-collar recompilation of every of such files may not be matter-of-

fact. In Unix, a value tool called craft is to be had to beat such difficulty.

Page 25: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 108

As a Unix usefulness tool create is very of use for managing the growth of

software on paper in any compilable indoctrination verbal communication including C++.

usually, the create agenda mechanically keeps path of all the records created all through

the growth procedure. By keeping path, we mean recompiling or relinking wherever

interdependencies live with these records, which may have been customized as a part of

the growth procedure.

3.8.1 An Invocation of a Make Utility

A “make” utility can be invoked form a UNIX shell with the following command:

>>make [-f mydescriptor]

where “make” is mandatory, while the text inside the bracket is optional. By default, the

make utility recompiles and relinks the source codes according to what specified in the

default descriptor file Makefile. If the descriptor file mydescriptor is specified, the utility

is use this file in place of the default file Makefile.

3.8.2 A Make Descriptor File

A descriptor file contains an teacher of how the codes should be recompiled and

relinked. Again, the defaulting descriptor file is the file named “Makefile”. A descriptor

file surround the names of the records that build up the executable, their

interdependencies, and how all file should be remake or recompiled. Such imagery are

particular during a chain of so-called “dependence rules”. every rule takes three

mechanism, i.e., targets, dependencies, and instructions. The following is the

arrangement of the dependence law:

<target1> [<target2> ...] : [<dependency1> ...] [<command>]

A aim with a colon sign is obligatory. all else inside the group are not compulsory. A aim

is more frequently than not the name of the file which needs to be remade if any

alteration is done to dependence files particular after the obligatory colon (:). If any alter

is noticed, the subsequent line execute to revive the goal dossier.

Page 26: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 109

3.8.3 NS2 Descriptor File

The NS2 descriptor file is defined in a file Makefile located in the home directiory

of NS2. It contains the details needed to recompile and relink NS2. The key relevant

details are those beginning with the following keywords.

• INCLUDES: The items behind this keyword are the directory which should be included

into the NS2 environment.

• OBJ_CC and OBJ_STL: The items behind these two keywords constitute the entire

NS2 object files. When a new C++ module is developed, its corresponding object file

name should be added here.

• NS_TCL_LIB: The items bind this keywords are the Tcl file of NS2. Again, when a

new OTcl module is developed, its corresponding Tcl file name should be added here.

Suppose a module consisting of C++ files myc.cc and myc.h and a Tcl file

mytcl.tcl. Suppose further that these files are created in a directory myfiles under the NS2

home directory. Then this module can be incorporated into NS2 using the following

steps:

(i) Include a string “I./myfiles” into the Line beginning with INCLUDES in the Makefile.

(ii) Include a string “myfile/myc.o” into the Line beginning with OBJ_CC or OBJ_STL

in the Makefile.

(iii) Include a string “myfile/mytcl.tcl” into the Line beginning with NS_TCL_LIB in the

Makefile.

(iv) Run make from the shell.

After running “make”, an executable file ns is created. We can now use this file ns to run

simulation.

3.9 Linkage Between OTcl and C++ in NS2

NS2 is an thing oriented simulator written in OTcl and C++ verbal

communication. as OTcl acts as the frontend, C++ acts as the backend in a row the real

simulation. As can be seen from Figure 3.5, class hierarchies of both words can be also

separate or linked together by an OTcl/C++ interface called TclCL. There are two types

of lessons in each area. The initial type include classes which are linked amid the C++

Page 27: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 110

and OTcl domain. In the text, these OTcl and C++ class hierarchies are referred to as the

interpret hierarchy and the collect pecking sort, in that sort. The second type comprise

OTcl and C++ classes which are not linked jointly. These classes are neither a part of the

take hierarchy nor a piece of collect hierarchy. This episode argue how OTcl and C++

languages comprise NS2. Class hierarchies in both the languages may be standalone or

linked together. OTcl and C++ class hierarchies which are linked together are called the

interpreted hierarchy and the compiled hierarchy, respectively.

Written in C++, TclCL consists of the following six main classes:

1) Class Tcl provides methods to access the interpreted hierarchy (from the compiled

hierarchy; Defined in files C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-1.18

and C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-1.18\Tcl.cc).

2) Class InstVar binds member variables in both the hierarchies together (Defined in file

C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-1.18\Tcl.cc).

3) Class TclObject is the base class for all C++ simulation objects in the compiled

hierarchy (defined in file C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-

1.18\Tcl.cc).

4) Class TclClass maps class names in the interpreted hierarchy to class names in the

compiled hierarchy (Defined in files C:\cygwin\home\rakeshpoonia\ns-allinone-

2.29\tclcl-1.18\tclcl.h and C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-

1.18\Tcl.cc).

5) Class TclCommand provides a global access to the compiled hierarchy from the

interpreted hierarchy (Defined in files C:\cygwin\home\rakeshpoonia\ns-allinone-

2.29\tclcl-1.18\tclcl.h and C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-

1.18\Tcl.cc).

6) Class EmbeddedTcl translates OTcl scripts into C++ codes (Defined in files

C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-1.18\tclcl.h,

C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-1.18\Tcl.cc, and

C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\common\tclAppInit.cc).

Page 28: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 111

One to one correspondence

Figure 3.5 Two language Structure of NS2.

3.10 The Two-Language Concept in NS2

Why two languages? insecurely speaking, NS2 uses OTcl to create and configure

a network, and uses C++ to run simulation. All C++ codes need to be accumulate and

linked to create an executable file. as the body of NS2 is fairly big, the collection time is

not insignificant. OTcl, on the additional hand, is an predictor, not a compiler. Any alter

in a OTcl file does not need collection. yet, since OTcl does not change all the codes into

device words, each line needs more execution time. In précis, C++ is fast to run but slow

to change. It is appropriate for running a large imitation. OTcl, on the other hand, is slow

to run but fast to alter. It is therefore appropriate to run a small imitation over several

repetition. NS2 is constructed by combine the advantages of these two languages. NS2

physical provides the next guidelines to decide a coding words:

• Use OTcl

– For pattern, setup, or one time imitation, or

– to run reproduction with obtainable NS2 unit.

This alternative is preferable for most beginners, as it does not engage complex internal

device of NS2. Unfortunately, existing NS2 modules are fairly limited. This alternative is

maybe not enough for nearly everyone researchers.

• Use C++

C++

The Compiledhierarchy

OTcl

The interpreted

hierarchy

Class

Class Class

Class

Class Class

Class

Class Class

Class

Class Class

Page 29: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 112

– when you are commerce with a packet, or

– when you need to modify obtainable NS2 modules.

This option maybe discourages most of the beginners from by NS2.

In code, one can develop a C++ program in three method.

1) Basic C++ is the simplest form and involve basic C++ instructions only. This method

has a flexibility difficulty, since any change in system limit requires a compilation

which takes non-negligible time of the whole agenda. Addressing the suppleness

difficulty,

2) C++ coding with input influence takes the system parameters as input influence. As

the scheme parameters change, we can just change the input arguments, and do not

need to recompile the entire program. The main difficulty of the second style is that

the chant could be quite long for a large figure of input influence.

3) C++ coding with pattern files puts all system parameter in a pattern file, and has the

C++ rules read the organization bound from the design file. This style does not have

the give difficulty, and it facilitate agenda invocation. To change system parameters,

we can simply change the content of the configuration file. In fact, this style acts as a

foundation from which NS2 develops.

To interpretation a script file through C++, NS2 reads the scheme configuration

from the Tcl simulation script. Again, when we alter the parameters, we do not need to

re-compile the entire NS2 code. All we have to do is to modify the Tcl imitation script

and re-run the simulation. deem the network topology in Figure 3.6 Define overall packet

relief delay as the time needed to bring a packet from the leftmost node to the rightmost

node, where wait in link i is delayi and total quantity of nodes is Total_numnodes.

Link Delay

Overall packet delivery delay

Figure 3.6 A chain topology for network simulation.

Packet

Page 30: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 113

3.11 Class Tcl

Class Tcl is a C++ class which acts as an interface to the OTcl domain. Declared

in file C:\cygwin\home\rakeshpoonia\ns-allinone-2.29\tclcl-1.18\Tcl.cc, it provides

methods for the following operations:

• Obtain the Tcl instance.

• Invoke OTcl procedures from within the C++ domain using functions eval(), evalc(),

and evalf().

• Pass or receive results to/from the interpreter using functions result() and resultF().

• Report error and quit the program in a uniform manner using function error().

• Retrieve the reference to TclObjects using functions enter(), delete (), and lookup().

3.11.1 Obtain a Reference to the Tcl Instance

In C++, class purpose are invoked from side to side a class object e.g., purpose

“fn” can be invoked by “object.fn”. To appeal to the on top of functions e.g., eval() and

result() of class Tcl, we need to have an object of class Tcl. Class Tcl provides purpose

instance() to get a static Tcl uneven:

Tcl& tcl = Tcl::case ();

Here, function case () of class Tcl income the static erratic instance_of class Tcl. as it is

static, in a imitation, there is only one Tcl object, instance. So, any try to retrieve a Tcl

object with the on top of declaration returns the same Tcl object. After get the Tcl thing,

we can appeal to class functions from side to side the Tcl instance e.g., eval() and result().

3.11.2 Invoking a Tcl Procedure

We may need to invoke an OTcl instance procedure (instproc) when

programming in C++. For example, we may obtain the current simulation time by

invoking instproc now() of class Simulator in the interpreted hierarchy.

3.11.3 Pass or Receive Results to/from the Interpreter

After execute few statements, we may need to pass or obtain values to/from the

interpreter. we may would like to pass the value of the generally small package delivery

Page 31: Chapter 2 Review of Literature 84 - INFLIBNET Centreshodhganga.inflibnet.ac.in/bitstream/10603/25166/5...srTCM and trTCM, in a DiffServ network. Results show that proposed scheme improves

Chapter 3 Materials & Methods 114

delay to the predictor instead of printing it to the monitor. Class Tcl provides three

purposes to pass principles back and onward flanked by the two hierarchies.

• Tcl::result(const char pointer fmt): pass the string consequence as the consequence to

the interpreter. For instance, the following declaration returns 50 to the predictor.

Tcl& tcl=Tcl::instance();

tcl.result("50");

return TCL_OK;

• Tcl::resultf(const char result): uses the arrangement of printf () in C++ to invent a result

cord, and passes the formulated string to the predictor. command returnDelay of class

string returns the cost in C++ patchy delay with one decimal digit to the analyst. The

realization of the domination returnDelay is set less:

Tcl& tcl=Tcl:: example();

tcl.resultf("%1.1f",delay);

go back TCL_OK;

From OTcl, the following declaration stores the worth of the variable “delay” of the C++

sequence object in the changeable “d”.

set chain [new Chain]

set d [$chain returnDelay]

sets the changeable d to be the same as the changeable delay in C++.

• Tcl::result(void): get back the result from the interpreter as a cord. For instance, the next

declaration store the value of the OTcl changeable “d” in the C++ uneven “delay”.

Tcl& tcl=Tcl:: example();

tcl.evalc("$d");

char baton delay = tcl.result();

Class Tcl uses a confidential associate variable tcl result() to pass results flanked by

the two hierarchies. Here, tcl is a member of class Tcl, and is a pole to a Tcl_Interp

object. NS2 protects tcl result() from being accessed on the exterior, and provides

three functions to access this variable.

a) Tcl::result(const char baton result) and