How to Simulate Star Bus Hybrid Topology Projects Using NS2

To simulate a Star-Bus Hybrid Topology using NS2 that requires encompassing to aggregate two basic topologies that is Star and Bus. This kind of hybrid topology is general in larger networks in which several star networks are associated through a bus topology. Every single star network contains a central hub (switch/router), even though the bus topology attaches the hubs of numerous stars. In the following below, we provided the basic simulation steps of Star-Bus Hybrid Topology and examples for you:

Steps to Simulate Star-Bus Hybrid Topology Projects in NS2

Step 1: Understand Star-Bus Hybrid Topology

In a Star-Bus Hybrid Topology:

  • Star Topology: Every single end node is associated to a central hub (switch or router) in its own local star network.
  • Bus Topology: The central hubs of the star topologies are attached to a distributed communication medium (bus), which allowing the communication amongst diverse star topologies.

This topology offers scalability, as several star networks can insert to the bus, and then each star topology handles its local traffic effectively.

Step 2: Design the Network

We will replicate a Star-Bus Hybrid Topology in which:

  • Two star topologies are made that each containing a central hub (switch) and various end devices.
  • A bus topology associates the central hubs of the star topologies.

Step 3: Create an NS2 TCL Script for Simulating the Star-Bus Hybrid Topology

Following is an NS2 TCL script, which mimics a Star-Bus Hybrid Topology with two star topologies are connected through a bus.

Example: Star-Bus Hybrid Topology Simulation in NS2

# Create a new NS2 simulator object

set ns [new Simulator]

# Create central hubs for two star topologies

set star1_hub [$ns node]  ;# Hub for Star 1

set star2_hub [$ns node]  ;# Hub for Star 2

# Create bus nodes to connect the star hubs

set bus_node1 [$ns node]  ;# Bus node connected to Star 1 hub

set bus_node2 [$ns node]  ;# Bus node connected to Star 2 hub

# Create end devices for Star 1

set star1_node1 [$ns node]    ;# End device 1 in Star 1

set star1_node2 [$ns node]    ;# End device 2 in Star 1

set star1_node3 [$ns node]    ;# End device 3 in Star 1

# Create end devices for Star 2

set star2_node1 [$ns node]    ;# End device 1 in Star 2

set star2_node2 [$ns node]    ;# End device 2 in Star 2

set star2_node3 [$ns node]    ;# End device 3 in Star 2

# Create the bus link between the bus nodes (shared medium)

$ns duplex-link $bus_node1 $bus_node2 10Mb 20ms DropTail

# Connect the star hubs to the bus nodes

$ns duplex-link $star1_hub $bus_node1 10Mb 10ms DropTail

$ns duplex-link $star2_hub $bus_node2 10Mb 10ms DropTail

# Connect end devices to the Star 1 hub

$ns duplex-link $star1_hub $star1_node1 1Mb 5ms DropTail

$ns duplex-link $star1_hub $star1_node2 1Mb 5ms DropTail

$ns duplex-link $star1_hub $star1_node3 1Mb 5ms DropTail

# Connect end devices to the Star 2 hub

$ns duplex-link $star2_hub $star2_node1 1Mb 5ms DropTail

$ns duplex-link $star2_hub $star2_node2 1Mb 5ms DropTail

$ns duplex-link $star2_hub $star2_node3 1Mb 5ms DropTail

# Attach UDP agents to the end devices for communication

set udp1 [new Agent/UDP]

set udp2 [new Agent/UDP]

$ns attach-agent $star1_node1 $udp1

$ns attach-agent $star2_node1 $udp2

# Attach Null agents to act as sinks at the opposite end devices

set null1 [new Agent/Null]

set null2 [new Agent/Null]

$ns attach-agent $star2_node1 $null1

$ns attach-agent $star1_node1 $null2

# Connect the UDP agents to their respective sinks

$ns connect $udp1 $null1

$ns connect $udp2 $null2

# Create CBR traffic between Star 1 and Star 2

set cbr1 [new Application/Traffic/CBR]

$cbr1 set packetSize_ 512

$cbr1 set interval_ 0.1

$cbr1 attach-agent $udp1

set cbr2 [new Application/Traffic/CBR]

$cbr2 set packetSize_ 512

$cbr2 set interval_ 0.1

$cbr2 attach-agent $udp2

# Start the traffic flows

$ns at 1.0 “$cbr1 start”

$ns at 1.5 “$cbr2 start”

# Create trace and nam files for recording the simulation events

set tracefile [open “star_bus_hybrid.tr” w]

$ns trace-all $tracefile

set namfile [open “star_bus_hybrid.nam” w]

$ns namtrace-all $namfile

# Define the finish procedure to close files and start NAM

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam star_bus_hybrid.nam &

exit 0

}

# Finish the simulation after 10 seconds

$ns at 10.0 “finish”

# Run the simulation

$ns run

Step 4: Explanation of the Script

  1. Network Setup:
    • Two star topologies are made, which each with a central hub (star1_hub and star2_hub) and three end devices are associated to the hubs.
    • A bus topology is generated with two bus nodes (bus_node1 and bus_node2) that are attached by a shared communication medium (the bus).
    • Each hub within the star topology is associated to a bus node.
  2. Communication Setup:
    • UDP agents are connected to end devices within Star 1 and Star 2, which allows the traffic among them through the bus.
    • Constant Bit Rate (CBR) traffic is made among the devices in diverse star topologies, including traffic from Star 1 being routed to Star 2 and vice versa.
  3. Link Characteristics:
    • The links among the central hubs and the end devices are set up including a bandwidth of 1Mb and a delay of 5ms to replicate the local star network communication.
    • The bus link associating the bus nodes includes a higher bandwidth of 10Mb and a longer delay of 20ms to replicate a shared medium with longer communication distances.
  4. Tracing and Visualization:
    • A trace file (star_bus_hybrid.tr) is made to record the network events, like packet transmissions, receptions, and drops.
    • A NAM file (star_bus_hybrid.nam) is created for envisioning the network topology and traffic flows.

Step 5: Run the Simulation

  1. We need to save the script as star_bus_hybrid.tcl.
  2. Execute the script in NS2:

ns star_bus_hybrid.tcl

It will create two files:

  • star_bus_hybrid.tr: A trace files, which records the packet-level information.
  • star_bus_hybrid.nam: A NAM file for envisoning the network in NAM.

Step 6: Visualize the Simulation Using NAM

To envision the Star-Bus Hybrid Topology within NAM:

nam star_bus_hybrid.nam

In NAM, we will observe:

  • The star topologies with the central hubs are attaching several end devices.
  • The bus link associating the central hubs of the two star topologies.
  • Packet transmissions among the devices within Star 1 and Star 2 via the bus.

Step 7: Analyze the Trace File

The trace file (star_bus_hybrid.tr) records every network events, like:

  • Packet transmissions and receptions among the nodes.
  • Packet drops or delays are triggered by network congestion or link conditions.

We can utilize the tools such as AWK, Python, or custom scripts to examine the trace file and extract crucial performance parameters like:

  • Packet delivery ratio (PDR).
  • End-to-end delay amongst nodes in distinct star topologies.
  • Network throughput over the bus.

Step 8: Enhance the Simulation

Below is a few ways to prolong or improve the simulation:

  1. Add More Star Topologies: Prolong the bus to associate additional star topologies, which replicating a larger hybrid network.
  2. Simulate Link Failures: Launch the link or node failures to monitor how the network performs when few links are down.
  3. Dynamic Traffic: Launch the diverse kinds of traffic like FTP, HTTP among the nodes to replicate additional realistic scenarios.
  4. Measure Performance Metrics: Investigate the performance parameters like latency, throughput, and packet loss under distinct traffic loads or failure situations.

Finally, we have seen how the Star Bus Hybrid Topology is simulated and executed in NS2 environment through this brief simulation procedure. If we have any doubts regarding this topic, we will clarify it whenever it rises.

phdprime.com team focus on the central hub (switch/router) for your projects. To assist you in simulating Star Bus Hybrid Topology Projects using the NS2 tool, we will provide you with comprehensive solutions and simulation support. Additionally, we can help you generate the best thesis ideas and topics customized to your concepts.

 

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2