How to Simulate Optical Network Projects Using NS2

To simulate Optical Networks in NS2 has needs to follow series of steps and it includes to designing optical communication technologies like Wavelength Division Multiplexing (WDM), optical switches, optical fibres, and wavelength assignment. Since NS2 doesn’t directly support detailed optical network functionalities, several extensions have been established to simulate Optical Networks. One popular extension is NS2-MIRACLE that adds capabilities for replicate optical and other advanced network types.

phdprime.com provide complete information concerning Optical Network Projects. Please share your details with us, and we will assist you in achieving optimal simulation results. Our technical team is dedicated to offering you thorough guidance and support regarding the functionalities of optical networks.

Here is an approach to simulate the optical network using ns2

Key Components for Simulating Optical Networks:

  1. Optical Fiber Links: Links that replicate the high-speed transmission of data over optical fibers.
  2. Wavelength Division Multiplexing (WDM): A method that permits multiple signals to be sent simultaneously on different wavelengths over the same optical fiber.
  3. Optical Switches: Devices that forward optical signals to their destination using wavelength switching.
  4. Routing and Wavelength Assignment (RWA): Algorithms that regulate the path and wavelength for each data transmission.
  5. Traffic Models: Numerous traffic patterns like TCP, UDP, or CBR to replicate the data being routed via the optical network.

Steps for Simulating Optical Networks in NS2

  1. Install NS2: Initially, make sure that NS2 is installed on the system. If NS2 is not installed, we can install it on a Linux system using:

sudo apt-get install ns2

Validate the installation by typing:

ns -version

  1. Install NS2 Optical Extensions (NS2-MIRACLE or Other Patches): Several extensions like NS2-MIRACLE add support for replicate optical networks, WDM, and related technologies. we can download the NS2-MIRACLE extension from its repository, or utilize other community-contributed patches for optical networks.
  2. Create an Optical Network Simulation Using a Tcl Script: Below is an instance Tcl script that replicates a basic WDM Optical Network using NS2 in which nodes interact over optical fiber links with WDM technology.

Example Tcl Script for Simulating a WDM Optical Network

# Create a new simulator object

set ns [new Simulator]

# Open trace and NAM files for output

set tracefile [open optical_out.tr w]

$ns trace-all $tracefile

set namfile [open optical_out.nam w]

$ns namtrace-all $namfile

# Define WDM optical fiber parameters

set opt(wavelengths) 4       ;# Number of wavelengths supported per link (WDM)

set opt(link_bw) 1Gb         ;# Bandwidth of each wavelength in Gbps

set opt(delay) 10ms          ;# Delay over each optical fiber link

set opt(nn) 4                ;# Number of optical nodes

set opt(txPower) 0.2         ;# Transmission power (optical)

set opt(rxPower) 0.1         ;# Reception power (optical)

# Create the optical network topology

set topo [new Topography]

$topo load_flatgrid 1000 1000

# Define optical node configurations

$ns node-config -propType Propagation/FreeSpace \

-phyType Phy/OpticalPhy \

-channelType Channel/OpticalChannel \

-llType LL \

-antType Antenna/OmniAntenna \

-ifqType Queue/DropTail/PriQueue \

-ifqLen 50 \

-topoInstance $topo

# Create optical nodes

set node_(0) [$ns node]

set node_(1) [$ns node]

set node_(2) [$ns node]

set node_(3) [$ns node]

# Set initial positions for optical nodes

$node_(0) set X_ 100.0

$node_(0) set Y_ 500.0

$node_(1) set X_ 300.0

$node_(1) set Y_ 500.0

$node_(2) set X_ 500.0

$node_(2) set Y_ 500.0

$node_(3) set X_ 700.0

$node_(3) set Y_ 500.0

# Create WDM optical links between nodes

$ns duplex-link $node_(0) $node_(1) $opt(link_bw) $opt(delay) DropTail

$ns duplex-link $node_(1) $node_(2) $opt(link_bw) $opt(delay) DropTail

$ns duplex-link $node_(2) $node_(3) $opt(link_bw) $opt(delay) DropTail

# Set up wavelength assignment for each link (WDM)

$ns at 0.0 “$node_(0) set-wavelength 1”

$ns at 0.0 “$node_(1) set-wavelength 2”

$ns at 0.0 “$node_(2) set-wavelength 3”

# Define TCP traffic from node 0 to node 3 over WDM

set tcp [new Agent/TCP]

$ns attach-agent $node_(0) $tcp

set sink [new Agent/TCPSink]

$ns attach-agent $node_(3) $sink

$ns connect $tcp $sink

# Create an FTP application to generate traffic on top of TCP

set ftp [new Application/FTP]

$ftp attach-agent $tcp

# Schedule the FTP traffic

$ns at 1.0 “$ftp start”

$ns at 5.0 “$ftp stop”

# Schedule the end of the simulation

$ns at 10.0 “finish”

# Define finish procedure to close trace files and run NAM

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam optical_out.nam &

exit 0

}

# Run the simulation

$ns run

Explanation of the Tcl Script:

  1. Wavelength Division Multiplexing (WDM):
    • The optical nodes interact over WDM links, with 4 wavelengths (opt(wavelengths)) supported per link.
    • Each link has a 1 Gbps bandwidth (opt(link_bw)) and a 10ms delay (opt(delay)), replicating the high-speed nature of optical communication.
  2. Optical Nodes:
    • Four optical nodes (node_0, node_1, node_2, node_3) are created, denotes points in the optical network.
  3. Wavelength Assignment:
    • Wavelengths are enthusiastically allocated to the links using the set-wavelength command, replicating WDM technology in which different signals are carried over isolate wavelengths.
  4. TCP Traffic:
    • A TCP agent is attached to node_0, and an FTP application creates traffic from node_0 to node_3 via the WDM links.
  5. Simulation End:
    • The simulation runs for 10 seconds, and the finish procedure closes the trace files and introduce NAM for visualization.
  1. Running the Simulation:

Save the script as optical_simulation.tcl and execute it using NS2:

ns optical_simulation.tcl

After the simulation done, open NAM to envision the network:

nam optical_out.nam

  1. Analysing the Results:
  • The trace file (optical_out.tr) contains complete logs of packet transmissions, receptions, and wavelength assignments. We need to evaluate the trace file for parameters such as:
    • Throughput
    • End-to-end delay
    • Packet delivery ratio
    • Wavelength utilization
  • Example AWK script to calculate throughput:

BEGIN {

packet_count = 0;

start_time = 0;

end_time = 0;

}

{

if ($1 == “r” && $4 == “AGT”) {

packet_count++;

if (start_time == 0) {

start_time = $2;

}

end_time = $2;

}

}

END {

duration = end_time – start_time;

throughput = (packet_count * 1000 * 8) / (duration * 1000);  # kbps

printf(“Throughput: %.2f kbps\n”, throughput);

}

Extending the Simulation:

  1. Routing and Wavelength Assignment (RWA):
    • Apply RWA algorithms to dynamically allocate wavelengths and routes according to network conditions and traffic demands.
  2. Optical Burst Switching (OBS):
    • Replicate Optical Burst Switching (OBS) in which data bursts are routed without converting the signal to the electrical domain at intermediate nodes.
  3. Optical Cross-connects (OXCs):
    • Add Optical Cross-connects (OXCs) to mimic the optical switching behaviour in a more complex optical core network.
  4. Dynamic Traffic Models:
    • Replicate dynamic traffic patterns, like video streaming, VoIP, or web traffic, to monitor on how the optical network manage real-world data.
  5. Wavelength Conversion:
    • Acquaint with wavelength conversion capabilities in which the nodes can convert incoming wavelengths to altered ones

As we discussed earlier about the simulation procedures that were utilized to simulate the optical network using ns2 tool and it contains the essential information like key components, step-by step procedure, explanation and extension for the simulation. If you need more details then feel free to ask!

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2