exp5 To plot refractive index profile of step index and graded index fiber
import numpy as np
import matplotlib.pyplot as plt
def graded_index_profile(radius, core_index, Del, alpha):
r = np.linspace(0, radius, 1000)
index_profile = core_index * (1 – (2 * Del * (r / radius)**alpha))
index_profile[r >= radius] = core_index * np.sqrt(1 – 2 * Del)
return r, index_profile
def plot_graded_index_fiber(radius, core_index, Del, alpha):
r, index_profile = graded_index_profile(radius, core_index, Del, alpha)
plt.figure(figsize=(8, 6))
plt.plot(r, index_profile, label=‘Refractive Index Profile’)
plt.axvline(x=radius, linestyle=‘–‘, color=‘red’, label=‘Core-Cladding Boundary’)
plt.title(‘Graded Index Fiber Refractive Index Profile (Alpha = 2)’)
plt.xlabel(‘Radius (micrometers)’)
plt.ylabel(‘Refractive Index’)
plt.legend()
plt.grid(True)
plt.show()
# Example usage
radius = 30 # micrometers
core_index = 1.5
Del = 0.01
alpha = 2
plot_graded_index_fiber(radius, core_index, Del, alpha)
exp9 Link Power Budget
colab Link
import math
l = int(input(“Enter length of fiber (km) : “))
pcx = int(input(“Enter input power (microW): “))
pc = 10 * math.log10(pcx*(10**-3))
print(“Input power in dbm is “, pc)
disp = input(‘Is there dispersion equilization penalty? (YES/NO)’)
if disp == ‘YES’:
dispersion = float(input(‘Enter dispersion ‘))
else:
dispersion = 0
pr = int(input(“Enter receiver power (dbm): “))
sm = int(input(“Enter system margin (dbm) : “))
lc = float(input(“Enter connector loss at receiver (dbm) : “))
lspx = float(input(“Enter splice loss (km/splice) : “))
lsp = lspx * (l – 1)
alphaf = float(input(“Enter fiber loss (dbm) : “))
allowed_loss = pc – pr
print(‘Allowed loss is ‘, allowed_loss)
actual_loss = (alphaf * l) + lsp + lc + sm + dispersion
print(‘Actual loss is ‘, actual_loss)
if(allowed_loss < actual_loss):
print(‘System is NOT viable’)
else:
print(‘System is viable’)
exp 10 Rise Time Budget
import java.util.Scanner;
public class FiberSystem {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print(“Enter length of the fiber (km): “);
double length = scanner.nextDouble();
System.out.print(“Enter Source rise time (ns): “);
double tx = scanner.nextDouble();
System.out.print(“Enter Receiver rise time (ns): “);
double rx = scanner.nextDouble();
System.out.print(“Enter intra rise time (ns): “);
double tintra = scanner.nextDouble();
System.out.print(“Enter Fiber bandwidth (MHz): “);
double fbw = scanner.nextDouble();
System.out.print(“Enter q: “);
double q = scanner.nextDouble();
double tinter = 0.44 * Math.pow(1, q) / (fbw * Math.pow(10, 6));
System.out.println(“Inter rise time is “ + String.format(“%.4f”, tinter) + ” (ns)”);
double tsys = Math.sqrt(Math.pow(tx, 2) + Math.pow(tintra, 2) + Math.pow(tinter, 2) + Math.pow(rx, 2));
System.out.println(“Total System rise time is “ + String.format(“%.4f”, tsys) + ” (ns)”);
double BR = 0.35 / (tsys * Math.pow(10, -9));
System.out.println(“Datarate is “ + String.format(“%.4f”, BR) + ” (Mbps)”);
scanner.close();
}
}