How to Simulate Fiber Optic Topology Projects Using NS2

To simulate a Fiber Optic Topology using NS2, this can be estimated to utilize the wired links including high bandwidth, low latency, and minimal packet loss that reflects the features of a real-world fiber optic network. Even though NS2 does not have a devoted an optical fiber module, it can be replicated the fiber optic networks by setting up wired links to design the high-speed and high-performance properties of optical communication.

To Simulate Fiber Optic Topology Projects Using NS2 reach out to phdprime.com we are experts in providing tailored assistance to scholars.

In this instance, we will be replicated a Fiber Optic Network Topology in which several nodes are associated with fiber-like characteristics like:

  • High bandwidth (e.g., 1Gbps or higher).
  • Low delay (e.g., in milliseconds).
  • Low error rates (simulated by setting low or zero packet drops).

Step 1: Understand Fiber Optic Topology

A Fiber Optic Topology can receive numerous forms, like point-to-point links, ring topology, or star topology that based on the network design. Fiber networks are known for:

  • High-speed communication.
  • Long-distance coverage without important signal degradation.
  • Low latency and high reliability.

Step 2: Design the Network

We will replicate a basic star topology in which numerous nodes are associated to a central switch (hub), and every links are set up to take after fiber optic connections.

Step 3: Create an NS2 TCL Script for Simulating a Fiber Optic Network

Here is an NS2 TCL script, which replicates a Fiber Optic Topology with various nodes are attached via high-speed fiber-like links to a central switch.

Example: Fiber Optic Topology Simulation in NS2

# Create a new NS2 simulator object

set ns [new Simulator]

# Define parameters for the fiber optic network

set link_bw 1Gb              ;# Bandwidth of fiber optic link (1 Gbps)

set link_delay 2ms            ;# Propagation delay (2 milliseconds)

set queue_size 100            ;# Queue size (100 packets)

set packet_drop_rate 0        ;# Packet drop rate for the fiber (close to 0, high reliability)

# Create nodes (central hub and multiple clients)

set hub [$ns node]  ;# Central switch/hub

set node1 [$ns node]  ;# Node 1

set node2 [$ns node]  ;# Node 2

set node3 [$ns node]  ;# Node 3

set node4 [$ns node]  ;# Node 4

# Connect nodes to the central hub with high-speed, low-delay fiber links

$ns duplex-link $hub $node1 $link_bw $link_delay DropTail

$ns duplex-link $hub $node2 $link_bw $link_delay DropTail

$ns duplex-link $hub $node3 $link_bw $link_delay DropTail

$ns duplex-link $hub $node4 $link_bw $link_delay DropTail

# Attach UDP agents to nodes for communication

set udp1 [new Agent/UDP]

set udp2 [new Agent/UDP]

$ns attach-agent $node1 $udp1

$ns attach-agent $node4 $udp2

# Attach Null agents to act as sinks

set null1 [new Agent/Null]

set null2 [new Agent/Null]

$ns attach-agent $node4 $null1

$ns attach-agent $node1 $null2

# Connect UDP agents to their respective sinks

$ns connect $udp1 $null1

$ns connect $udp2 $null2

# Create CBR traffic between nodes 1 and 4

set cbr1 [new Application/Traffic/CBR]

$cbr1 set packetSize_ 1024

$cbr1 set interval_ 0.01  ;# High-speed data rate, close to 1Gbps

$cbr1 attach-agent $udp1

set cbr2 [new Application/Traffic/CBR]

$cbr2 set packetSize_ 1024

$cbr2 set interval_ 0.01

$cbr2 attach-agent $udp2

# Start the traffic flows

$ns at 0.5 “$cbr1 start”

$ns at 1.0 “$cbr2 start”

# Create trace and nam files for recording the simulation events

set tracefile [open “fiber_optic_topology.tr” w]

$ns trace-all $tracefile

set namfile [open “fiber_optic_topology.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 fiber_optic_topology.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. Fiber-Like Link Setup:
    • The duplex links among the nodes and the central hub are set up to replicate the fiber optic properties:
      • Bandwidth: 1Gbps (can be modified higher for more advanced simulations).
      • Delay: 2ms to replicate the low latency of fiber optic communication.
      • Queue Size: 100 packets to handle the traffic on the link.
      • Packet Drop Rate: We can use DropTail including no deliberate packet drops to mimic the high reliability of fiber optic networks.
  2. Network Topology:
    • A star topology is utilized in which nodes (node1, node2, node3, node4) are associated to a central hub (hub).
    • The hub performs like a fiber switch or central router that handling traffic among the connected devices.
  3. Communication Setup:
    • UDP agents are connected to node1 and node4 for communication.
    • CBR (Constant Bit Rate) traffic is made among the node1 and node4, which replicating high-speed data flow normal of the fiber optic networks.
  4. Tracing and Visualization:
    • A trace file (fiber_optic_topology.tr) records every network events, like packet transmissions, receptions, and drops.
    • For envisioning the network topology and the communication amongst the nodes, NAM file (fiber_optic_topology.nam) is made.

Step 5: Run the Simulation

  1. We can save the script as fiber_optic_topology.tcl.
  2. Execute the script in NS2:

ns fiber_optic_topology.tcl

It will create two files:

  • fiber_optic_topology.tr: A trace files, which records the packet-level data.
  • fiber_optic_topology.nam: A NAM file for envisioning the network in NAM.

Step 6: Visualize the Simulation Using NAM

To envision the Fiber Optic Topology in NAM:

nam fiber_optic_topology.nam

In NAM, we will observe:

  • The central hub associated to numerous nodes.
  • Packet transmissions among the nodes, including high-speed traffic flowing as of node1 to node4 via the central hub.

Step 7: Analyze the Trace File

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

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

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

  • Packet delivery ratio (PDR).
  • End-to-end delay among the nodes.
  • Network throughput.

Step 8: Enhance the Simulation

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

  1. Simulate Larger Networks: Maximizes the amount of nodes and scale the topology for larger networks, like metro or WAN fiber networks.
  2. Simulate Fiber Failures: Launch link failures and monitor how the network retrieves or reroutes the traffic.
  3. Dynamic Traffic: Replicate several kinds of traffic (e.g., video streaming, large file transfers) to design the real-world fiber optic networks.
  4. Multiple Hubs or Layers: Make more complex topologies by including additional hubs or switches to mimic the multi-layered fiber networks.
  5. QoS Parameters: Execute Quality of Service (QoS) aspects to prioritize diverse kinds of traffic across the fiber links.

As explained above, we can get vital information on how to approach and simulate the Fiber Optic Topology projects via NS2 tool. If you need any more details of this project, we will provide you.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2