Skip to main content

This is a Python package for the implementation of various equations of Free Space Optical Communication

Project description

Freesopy

A Python package for the implementation of various equations of Free Space Optical Communication


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 :

  1. main.py
  2. transmitter.py
  3. reciever.py
  4. environment.py

transmitter.py

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)

reciever.py

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
p_n =                # ambient 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.

environment.py

lx =              # dimensions of room
ly =              # dimensions of room
lz =              # dimensions of room
wl =              # wavelength
alpha =           # atmospheric attenuation coefficient
sigma_s =         # standard deviation due to scintillation
cn =              # refractive structure parameter
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:

import freesopy as fso
from transmitter import *
from reciever import *
from environment import *

Some General Equations

P_t: Transmitted power in mW
D_r: Receiver aperture diameter in meters
d: Distance between transmitter and receiver in meters
P_r: Received power in mW
L_p: Path loss in dB
N_0: Noise power spectral density in mW/Hz

Calculate Received Power

Power_received = fso.calculate_received_power(P_t, D_r, d)

Calculate Path Loss

Path_loss = fso.calculate_path_loss(P_t, P_r)

Calculate SNR

SNR = fso.calculate_snr(P_r, N_0)

Calculation of Losses

wl = wavelength
d= distance between transmitter and receiver
alpha= atmospheric attenuation coefficient
dt= diameter of transmitter antenna
dr = diameter of receiver antenna
pt = power total
pn = power of ambient noise
sigma_p = standard deviation of pointing error
sigma_s= standard deviation due to scintillation
gamma = initial intensity of optical beam
cn = refractive structure parameter
theta= angle of divergence
theta_mis = mismatch angle divergence


Attenuation Loss

attenuation_loss = fso.atmospheric_attenuation_loss(gamma, alpha, d)

Geometric Loss

geo_loss = fso.geometric_loss(dr, dt, d, wl, pt)

Misalignment Loss

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

Atmospheric Turbulence

turbulence_loss = fso.atmospheric_turbulence(pt, cn, d, wl)

Polarising Loss Power

polarising_loss_power = fso.polarising_loss_power(pt, theta_mis)

Ambient Noise

ambient_noise = fso.ambient_noise(pt, pn)

Beam Divergence Loss

divergence_loss = fso.beam_divergence_loss(theta, d, pt)

Scintillation Loss

scintillation_loss = fso.scintillation_loss(sigma_s, pt)

General Graphs and Calculations

P_received : Received optical power (W)
responsivity : Responsivity of the photodetector (A/W)
T : Temperature (K)
B : Bandwidth (Hz)
R_load : Load resistance (Ohms)
I_photo : Photocurrent (A)
I_shot_squared : Shot noise squared (A^2)
I_thermal_squared : Thermal noise squared (A^2)
SNR : Signal-to-Noise Ratio (unitless)

SNR Calculations

I_photo = fso.calculate_photocurrent(P_received, responsivity)

I_thermal_squared = fso.calculate_thermal_noise(T, B, R_load)

I_shot_squared = fso.calculate_shot_noise(I_photo, B)

SNR = fso.calculate_SNR(I_photo, I_shot_squared, I_thermal_squared)

fso.plot_SNR(P_received, SNR)

Free Space Path Loss (FSPL)

f: Frequency (Hz)
d_range: Tuple defining the minimum and maximum distance in metres
num_points: Number of distance points to generate

fso.plot_fspl(f, d_range, num_points)

Divergence of Optical Beam

w_0: Initial beam waist (m)
lambda_light: Wavelength of the light (nm)
d_range: Tuple defining the minimum and maximum distance (meters)
num_points: Number of distance points to generate

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

Channel Modelling

Simulating the LOS channel gain

Parameters:

theta : (float) Semi-angle at half power (in degrees).
P_total : (float) Transmitted optical power by individual LED (in watts).
Adet : (float) Detector physical area of a PD (in square meters).
Ts : (float) Gain of an optical filter (default is 1 if no filter is used).
index : (float) Refractive index of a lens at a PD (default is 1.5 if no lens is used).
FOV : (float) Field of View of a receiver (in radians).
lx, ly, lz : (float) Room dimensions (in meters).
h : (float) Distance between the source and the receiver plane (in meters).
XT, YT : (float) Position of the LED (in meters).

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

Plotting the Optical Power Distribution in a Diffuse Channel

Parameters:

P_total : (float) Total transmitted power (default is 1 watt).
rho : (float) Reflection coefficient (default is 0.8).
lx, ly, lz : (float) Room dimensions in meters.
FOV : (float) Field of View (in radians).
Adet : (float) Detector area (default is 1e-4 square meters).
Ts : (float) Gain of optical filter (default is 1 if no filter is used).
G_Con : (float) Gain of an optical concentrator (default is 1 if no lens is used).
theta : (float) Semi-angle at half power (in degrees).

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

Simulation of the Drms of a Diffuse Channel

Parameters:
C : (float) Speed of light in nanoseconds per meter

theta : (float) Semi-angle at half power of the LED's radiation pattern (in degrees).

P_total : (float) Total transmitted power by the LED (in watts).

Adet : (float) Detector physical area of the photodetector (PD) (in square meters).

rho : (float) Reflection coefficient of the walls, representing how much light is reflected.

Ts : (float) Gain of the optical filter.

index : (float) Refractive index of the lens at the photodetector.

FOV : (float) Field of View (in degrees) of the receiver.

lx, ly, lz : (float) Dimensions of the room (in meters).

delta_t : (float) Time resolution in nanoseconds.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freesopy-2.0.0.tar.gz (7.4 kB view details)

Uploaded Source

File details

Details for the file freesopy-2.0.0.tar.gz.

File metadata

  • Download URL: freesopy-2.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.1

File hashes

Hashes for freesopy-2.0.0.tar.gz
Algorithm Hash digest
SHA256 58eb03f471f9baf5ad4cd5d1bc4b199012ff03bfad385f11c779c106018ee4b5
MD5 b10e7bfa89309378b9fd91f40a753feb
BLAKE2b-256 48d50864039c8c23c7aa4026078c1d603819bc1b539e45557ee74afabdd11551

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page