Metadata-Version: 2.1
Name: freesopy
Version: 2.0.3
Summary: This is a Python package for the implementation of various equations of Free Space Optical Communication
Author:  Shoaib , Deepak and Tanvi 
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: matplotlib

<p align="center">
  
</p>

<h1 align="center">Freesopy</h1>

<p align="center">
  <i>A Python package for the implementation of various equations of Free Space Optical Communication</i>
</p>

<hr>


`Freesopy` is designed to simplify the implementation of various mathematical equations used in Free Space Optical Communication. It provides easy-to-use functions that can be integrated into your projects.

## Structure

Create at least 4 seperate python files in same directory : <br>
<ol>
<li>main.py</li>
<li>transmitter.py</li>
<li>reciever.py</li>
<li>environment.py</li>
</ol>

<b>transmitter.py</b>
```bash
xt =          # location of transmitter
yt =          # location of transmitter
zt =          # location of transmitter
p_t =         # transmitted power
d_t =         # diameter of transmitter antenna
theta_d =     # angle of divergence
w_0 =         # initial beam waist
theta_semi =  # Semi-angle at half power of the LED's radiation pattern (in degrees)
```
<b>receiver.py</b>
```bash
xr =                 # location of receiver
yr =                 # location of receiver
zr =                 # location of receiver
d_r =                # aperture diameter of receiver
p_r =                # power received by receiver
n_0 =                # noise power
T =                  # temperature of receiver
B =                  # Bandwidth
r_load =             # Load resistance
i_photo =            # Photocurrent
i_shot_squared =     # Shot noise squared
i_thermal_squared =  # thermal noise squared
Adet =               # Detector physical area of the photodetector (PD) (in square meters)
Ts =                 # Gain of an optical filter
index =              # Refractive index of the lens at the photodetector.
FOV =                # Field of View (in degrees) of the receiver.
```
<b>environment.py</b>
```bash
lx =              # dimensions of room 
ly =             # dimensions of room 
lz =            # dimensions of room 
wl =              # wavelength 
sigma_s =        # standard deviation due to scintillation 
f =              # frequency 
d_range =        # Tuple defining the minimum and maximum distance in metres 
num_points =      # Number of distance points to generate 
rho =            # Reflection coefficient of the walls, representing how much light is reflected. 
delta_t =        # Time resolution in nanoseconds 
```

## Usage

You can import `Freesopy` and the python files containing information about Transmitterr(transmitter.py),reciever(reciever.py) and Environment(environment.py) in your main.py file as:

```bash
import freesopy as fso
from transmitter import *
from receiver import *
from environment import *
```

## Some General Equations

<h3>Calculate Received Power</h3>
Power_received = fso.calculate_received_power(P_t, D_r, d)

<h3>Calculate SNR</h3>
SNR = fso.calculate_snr(P_r, N_0)


## Calculation of Losses

<h3>Misalignment Loss</h3>

misalignment_loss = fso.pointing_misalignment_loss(d, sigma_p, pt)

## General Graphs and Calculations

<h3>SNR Calculations</h3>


I_photo = fso.calculate_photocurrent(P_received, responsivity)<br><br>
I_thermal_squared = fso.calculate_thermal_noise(T, B, R_load)<br><br>
I_shot_squared = fso.calculate_shot_noise(I_photo, B)<br><br>
SNR = fso.calculate_SNR(I_photo, I_shot_squared, I_thermal_squared)<br><br>
fso.plot_SNR(P_received, SNR)<br><br>

<h3>Free Space Path Loss (FSPL)</h3>

fso.plot_fspl(f, d_range, num_points)

<h3>Divergence of Optical Beam</h3>

fso.plot_beam_divergence(w_0, lambda_light, d_range, num_points)

## Channel Modelling
<h3>Simulating the LOS channel gain</h3>


fso.los_channel_gain(theta, P_total, Adet, Ts, index, FOV, lx, ly, lz, h, XT, YT)

<h3>Plotting the Optical Power Distribution in a Diffuse Channel</h3>



fso.optical_power_distribution(P_total, rho, lx, ly, lz, FOV, Adet, Ts, G_Con, theta)

<h3>Simulation of the Drms of a Diffuse Channel</h3>

fso.calculate_Drms_3D(C, theta, P_total, Adet, rho, Ts, index, FOV, lx, ly,
                       lz, delta_t)


