SlideShare a Scribd company logo
1 of 17
Download to read offline
RECOMPILING NETWORK
SIMULATOR 2
Recompilation ways
Modifying Existing code
A magic word “make”.
Correct the errors if any
No need for changing
the Makefile.in
Adding a New Module
Create a folder for the
project
Specify the folder name
along with the object file to
Makefile.in
Execute “make” command
Recompilation ways
¤ For UG and PG Projects,
existing code modification
is advisable as the time
frame is just 4 to 8 months
¤ For research scholars, a
new protocol, packet,
agent, application can be
created.
Modifying the existing code
Important: Always start with the basic. Learn
how existing algorithm works and how the
parameters can be changed for wired, wireless
and satellite networks.
Should have the knowledge of C++ and its
object oriented concepts and the strong use of
pointers
Understanding the existing
protocol is must
Do some basic simulations
based on the existing code.
(examples may be taken
from NS2 library)
Dedicate the 50 to 70% of
the work for existing code
and rest will be the
modification code.
Recompilation
¤ Must have the basics of the C++
classes of NS2 and linkages
between the OTCL and C++.
¤ For implementing a new protocol,
the following should be designed
■ Packet header
■ Agent (use the existing agent)
■ Application (use the existing app)
■ Routing, etc.
Example- Modifying the existing code
Finding the Node Position, speed and Velocity of a
Node while using AODV
Files to be modified
¤ ~ns-2.34/aodv/aodv.h
¤ ~ns-2.34/aodv/aodv.cc
¤ Please look at the corresponding File
Example..
Step 1: Open
~ns-2.34/aodv/aodv.h
include the following header
line in aodv.h
#include<mobilenode.h>
Step2: In protected scope declare the
variables you would be using to store
the node parameters.
double xpos;
double ypos;
double zpos;
double iEnergy;
int node_speed;
MobileNode *iNode;
FILE *fp;
Example..
Step 3: In aodv.cc initialize the declared variables in the constructor
xpos = 0.0;
ypos = 0.0;
zpos = 0.0;
node_speed = 0;
iEnergy=0.0;
fp=fopen("pradeep.csv","w");
MobileNode *iNode;
Example
Paste the following lines in the AODV::forward() function
//Code by pradeepkumar
/***This code retrieves node position*****/
fprintf(fp,"Position is, X, Y, Z, Velocity is, X, Y, Z, Velocity, Node Speed,
Energy n");
iNode = (MobileNode*) (Node::get_node_by_address(index));
((MobileNode *) iNode)->getLoc(&xpos,&ypos,&zpos);
//Position of %d , X, Y, Z
fprintf(fp,"%d,%f,%f,%f,", index, xpos, ypos, zpos);
Example
/***This code retrieves the nodes velocity*****/
iNode = (MobileNode*)
(Node::get_node_by_address(index));
((MobileNode *) iNode)->getVelo(&xpos, &ypos,
&zpos);
//Velocity of %d , X, Y, Z
fprintf(fp,"%d,%f,%f,%f,", index, xpos, ypos, zpos);
Example
/***This code retrieves the nodes speed*****/
iNode = (MobileNode*)
(Node::get_node_by_address(index));
node_speed = ((MobileNode *) iNode)->speed();
iEnergy=iNode->energy_model()->energy();
//Velocity of %d , Node Speed in m/s Energy in joules
fprintf(fp,"%d,%d,%f,", index, node_speed,iEnergy);
Example 2: Recompilation
There are totally 6 steps
Step1:
Create a folder mytcp in ~ns-2.34/
Copy all .cc and .h files in the ~ns-2.34/mytcp
Example 2: Recompilation
Step 2.
make an entry in the ~ns-2.34/Makefile.in
in OBJ_CC
mytcp/tcp-westwood.o mytcp/tcp-westwood-nr.o 
Step 3.
Using Shell, go to ~ns-2.34/
Example 2: Recompilation
Step 4 - Run the commands
./configure
make
5. Copy the following lines in the ~ns-2.34/tcl/lib/ns-
default.tcl
Example2
# Added for TCP WestwoodNR
Agent/TCP/WestwoodNR set current_bwe_ 0
Agent/TCP/WestwoodNR set last_bwe_sample_ 0
Agent/TCP/WestwoodNR set unaccounted_ 0
Agent/TCP/WestwoodNR set fr_a_ 1
Agent/TCP/WestwoodNR set min_rtt_estimate 10000
Agent/TCP/WestwoodNR set myseqno_ 1
Agent/TCP/WestwoodNR set lastackno_ 0
Agent/TCP/WestwoodNR set lastackrx_ 0
Agent/TCP/WestwoodNR set fr_alpha_ 0.9
Agent/TCP/WestwoodNR set filter_type_ 3
Agent/TCP/WestwoodNR set tau_ 1.0
# setting this to 1 implements some changes to reno
# proposed by Janey Hoe (other than fixing reno's
# unnecessary retransmit timeouts)
Agent/TCP/WestwoodNR set newreno_changes_ 0
# setting this to 1 allows the retransmit timer to expire
for
# a window with many packet drops
Agent/TCP/WestwoodNR set newreno_changes1_ 0
Agent/TCP/WestwoodNR set
partial_window_deflation_ 0
Agent/TCP/WestwoodNR set exit_recovery_fix_ 0
Example2
# Added for TCP Westwood
Agent/TCP/Westwood set current_bwe_ 0
Agent/TCP/Westwood set last_bwe_sample_ 0
Agent/TCP/Westwood set unaccounted_ 0
Agent/TCP/Westwood set fr_a_ 1
Agent/TCP/Westwood set min_rtt_estimate 10000
Agent/TCP/Westwood set myseqno_ 1
Agent/TCP/Westwood set lastackno_ 0
Agent/TCP/Westwood set lastackrx_ 0
Agent/TCP/Westwood set fr_alpha_ 0.9
Agent/TCP/Westwood set filter_type_ 3
Agent/TCP/Westwood set tau_ 1.0
Example2
Step 6. Run the file test-1-simple.tcl

More Related Content

What's hot

Pointers lesson 5 (double pointer, call by value, call_by_reference)
Pointers lesson 5 (double pointer, call by value, call_by_reference)Pointers lesson 5 (double pointer, call by value, call_by_reference)
Pointers lesson 5 (double pointer, call by value, call_by_reference)SetuMaheshwari1
 
java object oriented presentation
java object oriented presentationjava object oriented presentation
java object oriented presentationAli Ahsan Mujahid
 
Εξαγωγή Ιδιωμάτων από Αποθετήρια Κώδικα
Εξαγωγή Ιδιωμάτων από Αποθετήρια ΚώδικαΕξαγωγή Ιδιωμάτων από Αποθετήρια Κώδικα
Εξαγωγή Ιδιωμάτων από Αποθετήρια ΚώδικαISSEL
 
Extracting data from text documents using the regex
Extracting data from text documents using the regexExtracting data from text documents using the regex
Extracting data from text documents using the regexSteve Mylroie
 

What's hot (8)

Pointers lesson 5 (double pointer, call by value, call_by_reference)
Pointers lesson 5 (double pointer, call by value, call_by_reference)Pointers lesson 5 (double pointer, call by value, call_by_reference)
Pointers lesson 5 (double pointer, call by value, call_by_reference)
 
java object oriented presentation
java object oriented presentationjava object oriented presentation
java object oriented presentation
 
Εξαγωγή Ιδιωμάτων από Αποθετήρια Κώδικα
Εξαγωγή Ιδιωμάτων από Αποθετήρια ΚώδικαΕξαγωγή Ιδιωμάτων από Αποθετήρια Κώδικα
Εξαγωγή Ιδιωμάτων από Αποθετήρια Κώδικα
 
Dagstuhl2021
Dagstuhl2021Dagstuhl2021
Dagstuhl2021
 
20BCE1734.pdf
20BCE1734.pdf20BCE1734.pdf
20BCE1734.pdf
 
Java Semantics
Java SemanticsJava Semantics
Java Semantics
 
Extracting data from text documents using the regex
Extracting data from text documents using the regexExtracting data from text documents using the regex
Extracting data from text documents using the regex
 
Laporan Ambil IP
Laporan Ambil IPLaporan Ambil IP
Laporan Ambil IP
 

Similar to Modifying NS2 Code

advancedzplmacroprogramming_081820.pptx
advancedzplmacroprogramming_081820.pptxadvancedzplmacroprogramming_081820.pptx
advancedzplmacroprogramming_081820.pptxssuser6a1dbf
 
Who pulls the strings?
Who pulls the strings?Who pulls the strings?
Who pulls the strings?Ronny
 
Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)Hermann Hueck
 
Close encounters in MDD: when Models meet Code
Close encounters in MDD: when Models meet CodeClose encounters in MDD: when Models meet Code
Close encounters in MDD: when Models meet Codelbergmans
 
Close Encounters in MDD: when models meet code
Close Encounters in MDD: when models meet codeClose Encounters in MDD: when models meet code
Close Encounters in MDD: when models meet codelbergmans
 
Xtend api and_dsl_design_patterns_eclipse_confrance2016
Xtend api and_dsl_design_patterns_eclipse_confrance2016Xtend api and_dsl_design_patterns_eclipse_confrance2016
Xtend api and_dsl_design_patterns_eclipse_confrance2016Max Bureck
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy CodeRowan Merewood
 
Aspect-oriented programming in Perl
Aspect-oriented programming in PerlAspect-oriented programming in Perl
Aspect-oriented programming in Perlmegakott
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and batteryVitali Pekelis
 
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Igalia
 
Facebook Glow Compiler のソースコードをグダグダ語る会
Facebook Glow Compiler のソースコードをグダグダ語る会Facebook Glow Compiler のソースコードをグダグダ語る会
Facebook Glow Compiler のソースコードをグダグダ語る会Mr. Vengineer
 
Track A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBMTrack A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBMchiportal
 
Tips And Tricks For Bioinformatics Software Engineering
Tips And Tricks For Bioinformatics Software EngineeringTips And Tricks For Bioinformatics Software Engineering
Tips And Tricks For Bioinformatics Software Engineeringjtdudley
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.Jason Hearne-McGuiness
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core ModuleKatie Gulley
 
Deep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming LibraryDeep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming LibraryJim McKeeth
 
Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout source{d}
 

Similar to Modifying NS2 Code (20)

advancedzplmacroprogramming_081820.pptx
advancedzplmacroprogramming_081820.pptxadvancedzplmacroprogramming_081820.pptx
advancedzplmacroprogramming_081820.pptx
 
Who pulls the strings?
Who pulls the strings?Who pulls the strings?
Who pulls the strings?
 
Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)
 
Close encounters in MDD: when Models meet Code
Close encounters in MDD: when Models meet CodeClose encounters in MDD: when Models meet Code
Close encounters in MDD: when Models meet Code
 
Close Encounters in MDD: when models meet code
Close Encounters in MDD: when models meet codeClose Encounters in MDD: when models meet code
Close Encounters in MDD: when models meet code
 
Xtend api and_dsl_design_patterns_eclipse_confrance2016
Xtend api and_dsl_design_patterns_eclipse_confrance2016Xtend api and_dsl_design_patterns_eclipse_confrance2016
Xtend api and_dsl_design_patterns_eclipse_confrance2016
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
Aspect-oriented programming in Perl
Aspect-oriented programming in PerlAspect-oriented programming in Perl
Aspect-oriented programming in Perl
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and battery
 
Chtp414
Chtp414Chtp414
Chtp414
 
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
 
Facebook Glow Compiler のソースコードをグダグダ語る会
Facebook Glow Compiler のソースコードをグダグダ語る会Facebook Glow Compiler のソースコードをグダグダ語る会
Facebook Glow Compiler のソースコードをグダグダ語る会
 
Track A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBMTrack A-Compilation guiding and adjusting - IBM
Track A-Compilation guiding and adjusting - IBM
 
Tips And Tricks For Bioinformatics Software Engineering
Tips And Tricks For Bioinformatics Software EngineeringTips And Tricks For Bioinformatics Software Engineering
Tips And Tricks For Bioinformatics Software Engineering
 
opnet lab report
opnet lab reportopnet lab report
opnet lab report
 
A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.
 
Questions On The Code And Core Module
Questions On The Code And Core ModuleQuestions On The Code And Core Module
Questions On The Code And Core Module
 
ADCSS 2022
ADCSS 2022ADCSS 2022
ADCSS 2022
 
Deep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming LibraryDeep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming Library
 
Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout
 

More from Pradeep Kumar TS

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and FootprintPradeep Kumar TS
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)Pradeep Kumar TS
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesPradeep Kumar TS
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingPradeep Kumar TS
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication ProtocolsPradeep Kumar TS
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksPradeep Kumar TS
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2Pradeep Kumar TS
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Pradeep Kumar TS
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1Pradeep Kumar TS
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2Pradeep Kumar TS
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3Pradeep Kumar TS
 

More from Pradeep Kumar TS (20)

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and Footprint
 
Open book Examination
Open book ExaminationOpen book Examination
Open book Examination
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
 
Protothreads
ProtothreadsProtothreads
Protothreads
 
6LoWPAN
6LoWPAN 6LoWPAN
6LoWPAN
 
Software Defined Networks
Software Defined NetworksSoftware Defined Networks
Software Defined Networks
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication Protocols
 
IoT Applications
IoT ApplicationsIoT Applications
IoT Applications
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
 
Mannasim for NS2
Mannasim for NS2Mannasim for NS2
Mannasim for NS2
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2
 
Installation of ns2
Installation of ns2Installation of ns2
Installation of ns2
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3
 
Tracing and awk in ns2
Tracing and awk in ns2Tracing and awk in ns2
Tracing and awk in ns2
 

Recently uploaded

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 

Recently uploaded (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 

Modifying NS2 Code

  • 2. Recompilation ways Modifying Existing code A magic word “make”. Correct the errors if any No need for changing the Makefile.in Adding a New Module Create a folder for the project Specify the folder name along with the object file to Makefile.in Execute “make” command
  • 3. Recompilation ways ¤ For UG and PG Projects, existing code modification is advisable as the time frame is just 4 to 8 months ¤ For research scholars, a new protocol, packet, agent, application can be created.
  • 4. Modifying the existing code Important: Always start with the basic. Learn how existing algorithm works and how the parameters can be changed for wired, wireless and satellite networks. Should have the knowledge of C++ and its object oriented concepts and the strong use of pointers Understanding the existing protocol is must Do some basic simulations based on the existing code. (examples may be taken from NS2 library) Dedicate the 50 to 70% of the work for existing code and rest will be the modification code.
  • 5. Recompilation ¤ Must have the basics of the C++ classes of NS2 and linkages between the OTCL and C++. ¤ For implementing a new protocol, the following should be designed ■ Packet header ■ Agent (use the existing agent) ■ Application (use the existing app) ■ Routing, etc.
  • 6. Example- Modifying the existing code Finding the Node Position, speed and Velocity of a Node while using AODV Files to be modified ¤ ~ns-2.34/aodv/aodv.h ¤ ~ns-2.34/aodv/aodv.cc ¤ Please look at the corresponding File
  • 7. Example.. Step 1: Open ~ns-2.34/aodv/aodv.h include the following header line in aodv.h #include<mobilenode.h> Step2: In protected scope declare the variables you would be using to store the node parameters. double xpos; double ypos; double zpos; double iEnergy; int node_speed; MobileNode *iNode; FILE *fp;
  • 8. Example.. Step 3: In aodv.cc initialize the declared variables in the constructor xpos = 0.0; ypos = 0.0; zpos = 0.0; node_speed = 0; iEnergy=0.0; fp=fopen("pradeep.csv","w"); MobileNode *iNode;
  • 9. Example Paste the following lines in the AODV::forward() function //Code by pradeepkumar /***This code retrieves node position*****/ fprintf(fp,"Position is, X, Y, Z, Velocity is, X, Y, Z, Velocity, Node Speed, Energy n"); iNode = (MobileNode*) (Node::get_node_by_address(index)); ((MobileNode *) iNode)->getLoc(&xpos,&ypos,&zpos); //Position of %d , X, Y, Z fprintf(fp,"%d,%f,%f,%f,", index, xpos, ypos, zpos);
  • 10. Example /***This code retrieves the nodes velocity*****/ iNode = (MobileNode*) (Node::get_node_by_address(index)); ((MobileNode *) iNode)->getVelo(&xpos, &ypos, &zpos); //Velocity of %d , X, Y, Z fprintf(fp,"%d,%f,%f,%f,", index, xpos, ypos, zpos);
  • 11. Example /***This code retrieves the nodes speed*****/ iNode = (MobileNode*) (Node::get_node_by_address(index)); node_speed = ((MobileNode *) iNode)->speed(); iEnergy=iNode->energy_model()->energy(); //Velocity of %d , Node Speed in m/s Energy in joules fprintf(fp,"%d,%d,%f,", index, node_speed,iEnergy);
  • 12. Example 2: Recompilation There are totally 6 steps Step1: Create a folder mytcp in ~ns-2.34/ Copy all .cc and .h files in the ~ns-2.34/mytcp
  • 13. Example 2: Recompilation Step 2. make an entry in the ~ns-2.34/Makefile.in in OBJ_CC mytcp/tcp-westwood.o mytcp/tcp-westwood-nr.o Step 3. Using Shell, go to ~ns-2.34/
  • 14. Example 2: Recompilation Step 4 - Run the commands ./configure make 5. Copy the following lines in the ~ns-2.34/tcl/lib/ns- default.tcl
  • 15. Example2 # Added for TCP WestwoodNR Agent/TCP/WestwoodNR set current_bwe_ 0 Agent/TCP/WestwoodNR set last_bwe_sample_ 0 Agent/TCP/WestwoodNR set unaccounted_ 0 Agent/TCP/WestwoodNR set fr_a_ 1 Agent/TCP/WestwoodNR set min_rtt_estimate 10000 Agent/TCP/WestwoodNR set myseqno_ 1 Agent/TCP/WestwoodNR set lastackno_ 0 Agent/TCP/WestwoodNR set lastackrx_ 0 Agent/TCP/WestwoodNR set fr_alpha_ 0.9 Agent/TCP/WestwoodNR set filter_type_ 3 Agent/TCP/WestwoodNR set tau_ 1.0 # setting this to 1 implements some changes to reno # proposed by Janey Hoe (other than fixing reno's # unnecessary retransmit timeouts) Agent/TCP/WestwoodNR set newreno_changes_ 0 # setting this to 1 allows the retransmit timer to expire for # a window with many packet drops Agent/TCP/WestwoodNR set newreno_changes1_ 0 Agent/TCP/WestwoodNR set partial_window_deflation_ 0 Agent/TCP/WestwoodNR set exit_recovery_fix_ 0
  • 16. Example2 # Added for TCP Westwood Agent/TCP/Westwood set current_bwe_ 0 Agent/TCP/Westwood set last_bwe_sample_ 0 Agent/TCP/Westwood set unaccounted_ 0 Agent/TCP/Westwood set fr_a_ 1 Agent/TCP/Westwood set min_rtt_estimate 10000 Agent/TCP/Westwood set myseqno_ 1 Agent/TCP/Westwood set lastackno_ 0 Agent/TCP/Westwood set lastackrx_ 0 Agent/TCP/Westwood set fr_alpha_ 0.9 Agent/TCP/Westwood set filter_type_ 3 Agent/TCP/Westwood set tau_ 1.0
  • 17. Example2 Step 6. Run the file test-1-simple.tcl