How to Start DTN Protocols Projects Using NS2
To start a Delay Tolerant Network (DTN) protocol project using NS2, we must know about the concepts of DTN, configuring the environment, and executing or setting up protocols, which match the DTN situations. Below is a step-by-step mechanism to set up and simulate the DTN Protocol Projects using NS2:
Steps to Start DTN Protocols Projects in NS2
- Understand DTN and Protocols
DTN Characteristics:
- Intermittent connectivity and long delays.
- Store-and-forward interaction.
- In DTNs, general protocols such as Epidemic, Spray-and-Wait, and PRoPHET.
- Set Up NS2 for DTN
- Install NS2: We should download and install the NS2 environment on the system properly.
sudo apt-get install ns2
Confirm the installation:
ns
If NS2 effectively set up then we can execute.
- Check DTN Protocol Support: While NS2 doesn’t directly support DTN protocols, we can:
- Install extensions such as The ONE simulator or BonnMotion for mobility generation.
- In NS2, execute the custom protocols.
- Define the Project Scope
Focus on the project objectives like:
- Replicate the certain DTN mechanisms such as Epidemic, Spray-and-Wait.
- Equate the performance of protocol in terms of delivery ratio, latency, overhead.
- Create a custom DTN protocol or change an existing one.
- Create a DTN Scenario
DTN scenarios normally contain:
- Mobile nodes including intermittent links.
- It has a large topology or environment with sparse node distribution.
- Arbitrary or predefined mobility models.
- Write a TCL Script
Below is a simple outline for replicating DTN using Tcl script in NS2:
Example Script:
# Create a new simulator instance
set ns [new Simulator]
# Create a trace file for output
set tracefile [open dtn_protocol.tr w]
$ns trace-all $tracefile
# Define nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
# Set mobility (for DTN, use random mobility)
set topo [new Topography]
$topo load_flatgrid 500 500 # Simulation area
$ns node-config -adhocRouting Epidemic \
-llType LL -macType Mac/802_11 \
-ifqType Queue/DropTail/PriQueue -ifqLen 50 \
-antType Antenna/OmniAntenna -propType Propagation/TwoRayGround \
-phyType Phy/WirelessPhy -channelType Channel/WirelessChannel \
-topoInstance $topo
# Set node mobility
$ns at 0.0 “$n0 setdest 100 100 10.0”
$ns at 0.0 “$n1 setdest 200 200 10.0”
$ns at 0.0 “$n2 setdest 300 300 10.0”
# Define Epidemic or custom DTN protocol
set epidemic [new Agent/Epidemic]
$ns attach-agent $n0 $epidemic
# Define traffic sources
set udp0 [new Agent/UDP]
$ns attach-agent $n1 $udp0
set sink0 [new Agent/Null]
$ns attach-agent $n2 $sink0
$ns connect $udp0 $sink0
# Create traffic
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp0
$ns at 1.0 “$cbr start”
$ns at 10.0 “$cbr stop”
# Run simulation
$ns at 15.0 “finish”
proc finish {} {
global ns tracefile
$ns flush-trace
close $tracefile
exec nam dtn_protocol.nam &
exit 0
}
$ns run
- Implement or Add DTN Protocol
- In NS2, place the source directory as ~/ns-allinone/ns-2.xx/.
- Execute the custom protocols like Epidemic or PRoPHET using C++ files.
- Fine-tune routing or packet forwarding behavior.
When execute is accomplish then we can recompile NS2:
make clean
make
- Run the Simulation
- We will need to store the TCL script as dtn_simulation.tcl.
- Then execute the simulation with NS2:
ns dtn_simulation.tcl
- Envision the simulation outcomes in NAM file:
nam dtn_protocol.nam
- Analyze the Results
Following is primary parameters to examine the performance of DTN:
- Delivery ratio: Estimate the ratio of messages that are effectively distributed.
- Latency: Compute the average time during message delivery.
- Overhead: Estimate volume of redundant message copies.
- Buffer utilization: Node memory exhaustion.
Execute the trace file to leverage AWK, Python, or MATLAB tools for detailed analysis.
- Experiment with Different Scenarios
- Node density: Modify the volume of nodes and its mobility models for measuring the density of nodes.
- Protocol comparison: Replicate numerous DTN protocols to compute the performance.
- Traffic patterns: Test with diverse kinds of traffic models like CBR, FTP.
- Optional Enhancements
- Add The ONE simulator including realistic mobility models for DTN scenarios.
- Make DTN mobility patterns to utilize mobility generators such as BonnMotion.
- Model custom buffer management or forwarding mechanisms for DTN nodes.
- Document Your Findings
The project documentation or report should contain:
- Project’s goals and mechanisms.
- Network topology and protocol specifics.
- Outcomes for performance parameters such as delivery ratio, latency using graphs.
- Finally, it offers insights and references.
This guide covers more information about DTN Protocols, which was executed and analyzed using provided uncomplicated method in NS2, is accessible. If you have any concerns or queries on this topic, we will be addressed in a separate manual.