How to Implement Hybrid Satellite Terrestrial in NS2

To implement a Hybrid Satellite-Terrestrial Network using NS2 (Network Simulator 2), which contains simulating a network that merges both satellite and terrestrial communication systems. The satellite portion delivers the long-range connectivity, particularly for remote or isolated regions whereas the terrestrial portion usually contains the ground-based communication systems, like wireless access points, cellular networks, or wired networks.

This kind of network that we can have communication paths, which use both terrestrial and satellite links to distribute a robust, reliable communication infrastructure. We suggest the detailed procedure how we can set up and replicate such a network in NS2.

Steps to Implement a Hybrid Satellite-Terrestrial Network in NS2:

  1. Set up the Simulation Environment

Initially, make a nodes signifying the terrestrial network such as ground stations, mobile nodes and satellite network like satellite nodes. Establish links among these nodes with satellite-to-ground, satellite-to-satellite (inter-satellite links, ISL), and terrestrial communication links.

Example TCL Script for Basic Setup:

# Create a simulator instance

set ns [new Simulator]

# Set link parameters

set bw_sat 1Gb          ;# Bandwidth for satellite links

set delay_sat 100ms      ;# Delay for satellite communication

set bw_terrestrial 100Mb ;# Bandwidth for terrestrial links

set delay_terrestrial 10ms ;# Delay for terrestrial communication

# Create terrestrial network nodes

set ground1 [$ns node]   ;# Ground station 1

set ground2 [$ns node]   ;# Ground station 2

set mobile1 [$ns node]   ;# Mobile node 1

set mobile2 [$ns node]   ;# Mobile node 2

# Create satellite nodes

set satellite1 [$ns node]  ;# Satellite 1

set satellite2 [$ns node]  ;# Satellite 2

# Connect the terrestrial nodes (ground stations, mobile nodes) with terrestrial links

$ns duplex-link $ground1 $mobile1 $bw_terrestrial $delay_terrestrial DropTail

$ns duplex-link $ground2 $mobile2 $bw_terrestrial $delay_terrestrial DropTail

# Connect the ground stations to the satellite nodes (hybrid satellite-terrestrial links)

$ns duplex-link $ground1 $satellite1 $bw_sat $delay_sat DropTail

$ns duplex-link $ground2 $satellite2 $bw_sat $delay_sat DropTail

# Connect satellites with inter-satellite links (ISL)

$ns duplex-link $satellite1 $satellite2 $bw_sat $delay_sat DropTail

This setup makes a hybrid network where:

  • Ground stations and mobile nodes are communicate via terrestrial links.
  • Ground stations are connected to the satellites through satellite links.
  • Satellites communicate with each other using inter-satellite links (ISL).
  1. Define Mobility for Terrestrial Nodes (Optional)

If the terrestrial nodes like mobile nodes are moving, we can describe a mobility model for them. The simulation platform NS2 permits to replicate node movement using the setdest function that sets a new end for a node.

Example of Defining Mobility for Terrestrial Nodes:

# Set initial positions for mobile nodes

$mobile1 set X_ 0

$mobile1 set Y_ 0

$mobile2 set X_ 100

$mobile2 set Y_ 100

# Simulate movement of mobile nodes

$ns at 2.0 “$mobile1 setdest 200 200 10”  ;# Move mobile1 to new coordinates at 10 m/s

$ns at 3.0 “$mobile2 setdest 300 300 10”  ;# Move mobile2 to new coordinates at 10 m/s

It configures the first positions of the mobile nodes and describes their movement while the simulation.

  1. Configure Traffic between Nodes

To mimic communication in the hybrid satellite-terrestrial network and setup traffic among the nodes. We can configure UDP or TCP agents together with CBR (Constant Bit Rate) traffic to model data transfer among terrestrial and satellite nodes.

Example of Configuring Traffic Between Nodes:

# Create UDP agent for mobile node 1 (uplink to ground station 1)

set udp_mobile1 [new Agent/UDP]

$ns attach-agent $mobile1 $udp_mobile1

# Create CBR traffic generator for mobile node 1

set cbr_mobile1 [new Application/Traffic/CBR]

$cbr_mobile1 set packet_size_ 1000

$cbr_mobile1 set rate_ 500Kb

$cbr_mobile1 attach-agent $udp_mobile1

# Create UDP sink for mobile node 2 (downlink from ground station 2)

set null_mobile2 [new Agent/Null]

$ns attach-agent $mobile2 $null_mobile2

# Connect mobile node 1 to mobile node 2 via satellite links and ground stations

$ns connect $udp_mobile1 $null_mobile2

# Start and stop the traffic

$ns at 1.0 “$cbr_mobile1 start”

$ns at 10.0 “$cbr_mobile1 stop”

In this setup:

  • Mobile node 1 transfers the data to mobile node 2 via the terrestrial and satellite network.
  • The data moves from mobile node 1 to ground station 1, next to satellite 1, over to satellite 2, down to ground station 2, and lastly to mobile node 2.
  1. Dynamic Routing Between Satellites and Terrestrial Nodes

In a hybrid satellite-terrestrial network, we require to manage the routing among the satellite network and the terrestrial network. A dynamic routing protocol like AODV (Ad hoc On-Demand Distance Vector) can use to manage it.

Example of Enabling AODV for Routing:

# Enable AODV routing protocol for both satellite and terrestrial nodes

set val(rp) AODV

# Attach AODV routing to all terrestrial and satellite nodes

for {set i 1} {$i <= 6} {incr i} {

set node [set node($i)]

$ns at 0.0 “$node set ragent [new Agent/AODV]”

}

By using AODV routing protocol, the nodes are actively find the routes among terrestrial and satellite networks as the topology changes.

  1. Monitor and Trace the Simulation

Now, permitting tracing to observe the performance of the hybrid network that containing packet transmissions, routing updates, and mobility events. We can estimate this trace files to know how the network behaves and performs.

Enable Trace Files:       

# Enable tracing for the simulation

set tracefile [open “hybrid_satellite_terrestrial_trace.tr” w]

$ns trace-all $tracefile

# Define a finish procedure to end the simulation and close the trace file

proc finish {} {

global ns tracefile

$ns flush-trace

close $tracefile

exit 0

}

# Set the simulation end time

$ns at 20.0 “finish”

The trace file will capture the packet transmissions, routing changes, and mobility events, delivering the comprehensive details into the hybrid network’s behaviour.

  1. Run the Simulation

At the end, run the simulation to monitor the performance of the hybrid satellite-terrestrial network.

# Run the simulation

$ns run

Example Complete TCL Script for Hybrid Satellite-Terrestrial Network Simulation

# Create a simulator instance

set ns [new Simulator]

# Set link parameters

set bw_sat 1Gb

set delay_sat 100ms

set bw_terrestrial 100Mb

set delay_terrestrial 10ms

# Create terrestrial network nodes

set ground1 [$ns node]

set ground2 [$ns node]

set mobile1 [$ns node]

set mobile2 [$ns node]

# Create satellite nodes

set satellite1 [$ns node]

set satellite2 [$ns node]

# Connect the terrestrial nodes with terrestrial links

$ns duplex-link $ground1 $mobile1 $bw_terrestrial $delay_terrestrial DropTail

$ns duplex-link $ground2 $mobile2 $bw_terrestrial $delay_terrestrial DropTail

# Connect ground stations to the satellite nodes

$ns duplex-link $ground1 $satellite1 $bw_sat $delay_sat DropTail

$ns duplex-link $ground2 $satellite2 $bw_sat $delay_sat DropTail

# Connect satellites with inter-satellite links (ISL)

$ns duplex-link $satellite1 $satellite2 $bw_sat $delay_sat DropTail

# Set initial positions for mobile nodes

$mobile1 set X_ 0

$mobile1 set Y_ 0

$mobile2 set X_ 100

$mobile2 set Y_ 100

# Simulate movement of mobile nodes

$ns at 2.0 “$mobile1 setdest 200 200 10”

$ns at 3.0 “$mobile2 setdest 300 300 10”

# Create UDP agent for mobile node 1 (uplink to ground station 1)

set udp_mobile1 [new Agent/UDP]

$ns attach-agent $mobile1 $udp_mobile1

# Create CBR traffic generator for mobile node 1

set cbr_mobile1 [new Application/Traffic/CBR]

$cbr_mobile1 set packet_size_ 1000

$cbr_mobile1 set rate_ 500Kb

$cbr_mobile1 attach-agent $udp_mobile1

# Create UDP sink for mobile node 2 (downlink from ground station 2)

set null_mobile2 [new Agent/Null]

$ns attach-agent $mobile2 $null_mobile2

# Connect mobile node 1 to mobile node 2 via satellite and terrestrial links

$ns connect $udp_mobile1 $null_mobile2

# Start and stop the traffic

$ns at 1.0 “$cbr_mobile1 start”

$ns at 10.0 “$cbr_mobile1 stop”

# Enable AODV routing protocol for satellite and terrestrial nodes

set val(rp) AODV

for {set i 1} {$i <= 6} {incr i} {

set node [set node($i)]

$ns at 0.0 “$node set ragent [new Agent/AODV]”

}

# Enable tracing

set tracefile [open “hybrid_satellite_terrestrial_trace.tr” w]

$ns trace-all $tracefile

# End simulation

$ns at 20.0 “finish”

proc finish {} {

global ns tracefile

$ns flush-trace

close $tracefile

exit 0

}

# Run the simulation

$ns run

We successfully followed the above comprehensive methods including details concepts and relevant examples that helps you to setup and simulate the Hybrid satellite terrestrial using the NS2 tool. We had a plan will be offered entire information on this topic, if you required.

For the best Hybrid Satellite Terrestrial implementation outcomes for your projects, get in touch with ns2project.com. About your projects, we work on satellite and terrestrial links and deliver the best outcomes; ask us about project topics that are specifically suited to your needs.