Project Report_ Laser-based Optical Fiber Communication System Simulator (2)
Project Report_ Laser-based Optical Fiber Communication System Simulator (2)
Modulation Frequency: Represents the frequency at which the signal is modulated. It affects
the bandwidth of the communication system and is measured in megahertz (MHz).
Core Diameter: Refers to the diameter of the fiber core, which carries the signal. It is measured
in micrometers (μm).
Cladding RefractiveIndex: Represents the refractive index of the material surrounding the core
(cladding) of the optical fiber.
Core RefractiveIndex: Denotes the refractive index of the fiber core material.
Wavelength: Represents the wavelength of the light signal transmitted through the optical fiber.
It determines the characteristics of the signal and is measured in nanometers (nm).
Numerical Aperture (NA): A measure of the light-gathering ability of the optical fiber.
It is calculated using the formula:
Fiber Loss: Calculated as the product of the attenuation coefficient and the length of the optical
fiber:
Signal Power at the Receiver End: Represents the power of the signal received at the end of
the optical fiber after attenuation. It is calculated as:
Signal Attenuation: Indicates the reduction in signal power during transmission, measured in
decibels (dB):
Bandwidth: Refers to the range of frequencies over which the optical fiber communication
system can operate effectively. It is calculated based on the core diameter, wavelength, and
numerical aperture.
Bandwidth-Distance Product: Represents the maximum data rate that can be transmitted over
a given distance of optical fiber. It is calculated as the product of modulation frequency and fiber
length.
Parameters for Laser Calculations:
Frequency: Represents the repetition rate of the laser pulses, calculated as the inverse of the
pulse duration:
frequency = 1 / pulseDuration
Peak Power: Denotes the maximum power achieved during the laser pulse, calculated as the
ratio of energy to pulse duration:
These parameters and calculations are essential for understanding and analyzing the behavior
and performance of laser & optical communication systems, including signal transmission,
attenuation, dispersion, and laser characteristics
2. Objective
The primary objective of this project is to develop a comprehensive simulator for laser&optical
fiber communication systems. The simulator allows users to input parameters related to laser
properties, fiber characteristics, and system configurations to analyze signal transmission
behavior. By simulating different scenarios and analyzing the results, users can gain insights
into the performance of optical fiber communication systems under varying conditions.
3. Features
- Input parameters include laser power, fiber length, attenuation coefficient, modulation
frequency, core diameter, cladding refractive index, core refractive index, and wavelength of
light.
- Calculates signal power, attenuation, dispersion, bandwidth, and bandwidth-distance product
based on user input.
- Provides detailed simulation results for analysis and interpretation.
- Allows users to input parameters such as laser wavelength, power, energy, and pulse duration.
- Calculates frequency, peak power, and photon energy of the laser pulse.
- Enables analysis of laser characteristics and their impact on signal transmission.
- Utilizes ANSI escape codes to format text color in the console interface.
- Improves readability and visual presentation of simulation results.
- Differentiates between simulation sections for clarity.
4. Implementation Details
- Organized into modular functions for simulating optical fiber communication and laser
calculations.
- Main program structure includes a menu-based interface for user interaction.
- Ensures modularity, readability, and maintainability of the codebase.
- Integrates ANSI escape codes within the console interface for text color formatting.
- Implements color-coded output to distinguish between different simulation sections.
- Enhances the visual presentation of simulation results for better interpretation.
5.Code
#include <iostream>
#include <cmath>
// Function prototypes
void printIntroduction();
void printMenu();
void simulateOpticalFiberCommunication();
void simulateLaserCalculations() {
// Parameters
double wavelength; // Wavelength of light (in nanometers)
double power; // Power of the laser (in watts)
double energy; // Energy of the laser pulse (in joules)
double pulseDuration; // Duration of the laser pulse (in seconds)
// User input
std::cout << "Enter the wavelength of the laser (in nanometers): ";
std::cin >> wavelength;
std::cout << "Enter the power of the laser (in watts): ";
std::cin >> power;
std::cout << "Enter the energy of the laser pulse (in joules): ";
std::cin >> energy;
std::cout << "Enter the duration of the laser pulse (in seconds): ";
std::cin >> pulseDuration;
// Calculate frequency
double frequency = 1 / pulseDuration;
// Output results
std::cout << "\n" << ANSI_COLOR_WHITE << ANSI_COLOR_BLUE <<
"Simulation Results:" << ANSI_COLOR_RESET << std::endl;
std::cout << "Wavelength of the laser: " << wavelength << " nm" <<
ANSI_COLOR_RESET << std::endl;
std::cout << "Power of the laser: " << power << " watts" << ANSI_COLOR_RESET
<< std::endl;
std::cout << "Energy of the laser pulse: " << energy << " joules" <<
ANSI_COLOR_RESET << std::endl;
std::cout << "Duration of the laser pulse: " << pulseDuration << " seconds" <<
ANSI_COLOR_RESET << std::endl;
std::cout << "Frequency of the laser pulse: " << frequency << " Hz" <<
ANSI_COLOR_RESET << std::endl;
std::cout << "Peak power of the laser pulse: " << peakPower << " watts" <<
ANSI_COLOR_RESET << std::endl;
std::cout << "Photon energy: " << photonEnergy << " joules" <<
ANSI_COLOR_RESET << std::endl;
}
switch(choice) {
case '1':
simulateOpticalFiberCommunication();
break;
case '3':
std::cout << "Thank you for using the simulator.\n";
break;
case '2':simulateLaserCalculations(); break;
default:
std::cout << "Invalid choice. Please try again.\n";
}
} while(choice != '3');
return 0;
}
// User input
std::cout << "Enter the laser power (in milliwatts): ";
std::cin >> laserPower;
std::cout << "Enter the fiber length (in kilometers): ";
std::cin >> fiberLength;
std::cout << "Enter the attenuation coefficient (in dB/km): ";
std::cin >> attenuationCoefficient;
std::cout << "Enter the modulation frequency (in megahertz): ";
std::cin >> modulationFrequency;
std::cout << "Enter the core diameter (in micrometers): ";
std::cin >> coreDiameter;
std::cout << "Enter the cladding refractive index: ";
std::cin >> claddingRefractiveIndex;
std::cout << "Enter the core refractive index: ";
std::cin >> coreRefractiveIndex;
std::cout << "Enter the wavelength of light (in nanometers): ";
std::cin >> wavelength;
// Calculate numerical aperture (NA)
double numericalAperture = sqrt(coreRefractiveIndex * coreRefractiveIndex -
claddingRefractiveIndex * claddingRefractiveIndex);
// Calculate bandwidth
double bandwidth = calculateBandwidth(coreDiameter, wavelength,
numericalAperture);
double normalisedFrequency = calculateNormalisedFrequency(coreDiameter,
wavelength,numericalAperture);
// Output results
std::cout << "\n" << ANSI_COLOR_WHITE << ANSI_COLOR_BLUE <<
"Simulation Results:" << ANSI_COLOR_RESET << std::endl;
std::cout << "Signal power at the receiver end: " << signalPowerAtReceiver << "
mW" << ANSI_COLOR_RESET << std::endl;
// std::cout << "Signal attenuation: " << signalAttenuation << " dB" <<
ANSI_COLOR_RESET << std::endl;
std::cout << "Numerical aperture (NA): " << numericalAperture <<
ANSI_COLOR_RESET << std::endl;
// std::cout << "Dispersion: " << dispersion << " ps/(nm*km)" <<
ANSI_COLOR_RESET << std::endl;
std::cout << "Bandwidth: " << bandwidth << " MHz" << ANSI_COLOR_RESET <<
std::endl;
std::cout << "Bandwidth-distance product: " << bandwidthDistanceProduct << "
MHz-km" << ANSI_COLOR_RESET << std::endl;
std::cout << "Normalised Frequency or V Number : " << normalisedFrequency <<
ANSI_COLOR_RESET << std::endl;
}
// Function to calculate bandwidth
double calculateBandwidth(double coreDiameter, double wavelength, double
numericalAperture) {
return 2 * M_PI * coreDiameter * numericalAperture / wavelength;
// return M_PI;
}
douuble calculateNormalisedFrequency(double coreDiameter, double wavelength,
double numericalAperture)
{
return M_PI * coreDiameter * numericalAperture / wavelength;
}
Simulation Results:
Signal power at the receiver end: 485 mW
Numerical aperture (NA): 0.390512
Bandwidth: 0.14722 MHz
Bandwidth-distance product: 100 MHz-km
Normalised Frequency or V Number : 73.6099
---- Menu ----
1. Simulate Optical Fiber Communication
2. Simulate Laser Calculation
3. Exit
Enter your choice: 2
Enter the wavelength of the laser (in nanometers): 500
Enter the power of the laser (in watts): 100
Enter the energy of the laser pulse (in joules): 0.1
Enter the duration of the laser pulse (in seconds): 0.000000001
Simulation Results:
Wavelength of the laser: 500 nm
Power of the laser: 100 watts
Energy of the laser pulse: 0.1 joules
Duration of the laser pulse: 1e-009 seconds
Frequency of the laser pulse: 1e+009 Hz
Peak power of the laser pulse: 1e+008 watts
Photon energy: 3.9756e-019 joules
---- Menu ----
1. Simulate Optical Fiber Communication
2. Simulate Laser Calculation
3. Exit
Enter your choice: 3
Thank you for using the simulator.
7. Conclusion
The Laser & Optical Fiber Communication System Simulator is a valuable tool for researchers,
engineers, and students involved in the field of telecommunications. By providing a platform for
simulation and analysis, the simulator facilitates the study of optical fiber communication
systems and enables users to explore the impact of different parameters on system
performance. With its user-friendly interface and comprehensive features, the simulator serves
as an effective tool for learning, research, and development in the field of optical fiber
communication.
8. References