How to Simulate Extended Star Topology Projects Using NS2

To simulate an Extended Star Topology in ns2 has needs to follow numerous steps and it is a variant of the long established star topology in which the multiple star topologies are interrelated. In this configure, smaller star topologies are associated through a central node or hub, constructs a prolonged network.

Here’s how to replicate an Extended Star Topology project using NS2:

Steps to Simulate Extended Star Topology Projects in NS2

  1. Set up NS2 Environment:

Make sure that NS2 is installed and executes on the system. We will compose a TCL script to describe the prolonged star topology and replicate communication among the nodes.

  1. Understanding Extended Star Topology:
  • In an Extended Star Topology, there is multiple star topologies associated through a central hub or node. Each smaller star topology has its own central node, and these central nodes are interrelated.
  • This topology is scalable and enable for more devices to be incorporate by increasing star segments.
  1. Create a TCL Script for Extended Star Topology:

Below is an instance of a TCL script to mimic an Extended Star Topology with three smaller star networks associated by a central hub node:

# Create a new simulator instance

set ns [new Simulator]

# Open a NAM trace file for visualization

set nf [open out.nam w]

$ns namtrace-all $nf

# Create nodes for the central hub (central node connecting smaller star topologies)

set central_hub [$ns node]

# Create nodes for the first star topology

set s1_hub [$ns node]    ;# Hub of first star

set s1_n1 [$ns node]     ;# Node 1 of star 1

set s1_n2 [$ns node]     ;# Node 2 of star 1

set s1_n3 [$ns node]     ;# Node 3 of star 1

# Create nodes for the second star topology

set s2_hub [$ns node]    ;# Hub of second star

set s2_n1 [$ns node]     ;# Node 1 of star 2

set s2_n2 [$ns node]     ;# Node 2 of star 2

set s2_n3 [$ns node]     ;# Node 3 of star 2

# Create nodes for the third star topology

set s3_hub [$ns node]    ;# Hub of third star

set s3_n1 [$ns node]     ;# Node 1 of star 3

set s3_n2 [$ns node]     ;# Node 2 of star 3

set s3_n3 [$ns node]     ;# Node 3 of star 3

# Connect the central hub to each of the star topology hubs

$ns duplex-link $central_hub $s1_hub 10Mb 10ms DropTail

$ns duplex-link $central_hub $s2_hub 10Mb 10ms DropTail

$ns duplex-link $central_hub $s3_hub 10Mb 10ms DropTail

# Connect the hubs of each star topology to their respective nodes

$ns duplex-link $s1_hub $s1_n1 10Mb 10ms DropTail

$ns duplex-link $s1_hub $s1_n2 10Mb 10ms DropTail

$ns duplex-link $s1_hub $s1_n3 10Mb 10ms DropTail

$ns duplex-link $s2_hub $s2_n1 10Mb 10ms DropTail

$ns duplex-link $s2_hub $s2_n2 10Mb 10ms DropTail

$ns duplex-link $s2_hub $s2_n3 10Mb 10ms DropTail

$ns duplex-link $s3_hub $s3_n1 10Mb 10ms DropTail

$ns duplex-link $s3_hub $s3_n2 10Mb 10ms DropTail

$ns duplex-link $s3_hub $s3_n3 10Mb 10ms DropTail

# Attach UDP agents to simulate traffic

set udp_s1 [new Agent/UDP]

$ns attach-agent $s1_n1 $udp_s1

set udp_s2 [new Agent/UDP]

$ns attach-agent $s2_n2 $udp_s2

# Attach Null agents at receiving nodes

set null_s1 [new Agent/Null]

$ns attach-agent $s3_n3 $null_s1

set null_s2 [new Agent/Null]

$ns attach-agent $s1_n3 $null_s2

# Connect the UDP agents to Null agents

$ns connect $udp_s1 $null_s1

$ns connect $udp_s2 $null_s2

# Create CBR (Constant Bit Rate) traffic generators and attach them to UDP agents

set cbr_s1 [new Application/Traffic/CBR]

$cbr_s1 attach-agent $udp_s1

$cbr_s1 set packetSize_ 512    ;# Packet size of 512 bytes

$cbr_s1 set rate_ 100Kb        ;# Data rate of 100Kb

set cbr_s2 [new Application/Traffic/CBR]

$cbr_s2 attach-agent $udp_s2

$cbr_s2 set packetSize_ 512

$cbr_s2 set rate_ 100Kb

# Schedule the CBR traffic to start and stop

$ns at 1.0 “$cbr_s1 start”

$ns at 1.5 “$cbr_s2 start”

$ns at 5.0 “$cbr_s1 stop”

$ns at 5.5 “$cbr_s2 stop”

# End the simulation at 7 seconds

$ns at 7.0 “finish”

proc finish {} {

global ns nf

$ns flush-trace

close $nf

exec nam out.nam &

exit 0

}

# Run the simulation

$ns run

  1. Explanation of the Code:
  • Central Hub: A central node (central_hub) associates to three smaller star topologies. Each star topology has its own hub (s1_hub, s2_hub, s3_hub).
  • Star Topologies: Each star topology has a hub associated to three leaf nodes (s1_n1, s1_n2, s1_n3, etc.).
  • Links: Duplex links are generated among the central hub and the hubs of the smaller star topologies, and between each star hub and its associated leaf nodes. These links have a bandwidth of 10Mb and a latency of 10ms.
  • UDP Traffic: Two UDP agents are attached to nodes in diverse star networks to replicate traffic. Null agents are attached at the receiving nodes to perform as traffic sinks.
  • CBR Traffic: Constant Bit Rate (CBR) traffic generators are generated to transmit data from the UDP agents to the Null agents. The traffic initiates at 1 second and 1.5 seconds, correspondingly, and terminate at 5 seconds and 5.5 seconds.
  • Simulation End: The simulation terminates at 7 seconds, and the outcomes are saved in a .nam file for visualization.
  1. Run the Simulation:
  1. Save the script as extended_star_topology.tcl.
  2. Open a terminal and navigate to the directory in which the script is saved.
  3. Execute the simulation using the following command:

ns extended_star_topology.tcl

  1. The simulation will create out.nam file that can be envisioned using Network Animator (NAM).
  1. Visualization in NAM:
  • Open the out.nam file in NAM to envision the Extended Star Topology. We should see the central hub associated to three smaller star networks, with traffic flowing among the nodes in diverse star segments.
  1. Customization and Enhancements:
  • Add More Star Topologies: We can easily expand this simulation by incorporating more star topologies and associates them to the central hub.
  • TCP Traffic: we can replace the UDP agents with TCP agents to replicate reliable data transmission:

set tcp_s1 [new Agent/TCP]

$ns attach-agent $s1_n1 $tcp_s1

set sink_s1 [new Agent/TCPSink]

$ns attach-agent $s3_n3 $sink_s1

$ns connect $tcp_s1 $sink_s1

  • Different Bandwidth/Delay: we can test with different link parameters, like higher bandwidth or different latency among the nodes.
  • Multiple Traffic Flows: incorporate more traffic sources to replicate different communication patterns among the nodes.
  1. Performance Analysis:

To evaluate the performance of the Extended Star Topology, we can:

  • Assess throughput by evaluating the number of data successfully routed among nodes.
  • Assess latency (delay) for data to pass through the central hub and reach the destination nodes.
  • Measure packet loss uncertainty there is network difficulties or congestion.

From this procedure, you can get to know more about the simulation process regarding the Extended Star Topology projects using Network Simulator 2 (ns2) including sample snippet codes. We have to evaluate its performance to enhance the performance. If you need any details about this topic, we will provide it. Our team is dedicated to managing the central node effectively. For optimal outcomes, we encourage you to maintain communication with us. At phdprime.com, we provide guidance on simulating Extended Star Topology Projects using the NS2 tool. If you are seeking reliable research support and simulation assistance, you can trust our experts to help you.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2