#Initialisation
h=2 #height in Km
h1=5 #height in Km
#Calculation
t2=290-(6.5*h) #Proposed formula for height h=2Km
p2=950-117*h
e2=8-3*h
t21=294.98-5.22*h-0.007*h**2
p21=1012.82-111.56*h+3.86*h**2
p=14.35*2.72**(-0.42*h-0.02*h*h+0.001*h**3)
t5=290-6.5*h1 #Proposed formula for height h=5Km
p5=950-117*h1
e5=8-3*h1
t51=294.98-5.22*h1-0.007*h1**2
p51=1012.82-111.56*h1+3.86*h1**2
p1=14.35*2.72**(-0.42*h1-0.02*h1**2+0.001*h1**3)
#Results
print'T(2) = %.1f K'%t21
print'P(2) = %.2f hpa'%p21
print'p(2) = %.2f hpa\n'%p
print'T(5) = %.1f K'%t51
print'P(5) = %.2f hpa'%p51
print'p(5) = %.2f hpa'%p1
#Initialisation
h=2 #Height in Km
T=277 #Tempreture in Kelvin
p=716
e=2
#Calculation
er=1+(151.1/T)*(p+(4810*h/T))*10**-6
n=er**(0.515) #refractive index of the air
N=(n-1)*10**6 #refractivity number
#Results
print'n = %.5f'%n
print'N = %d'%N
#Initialisation
er=1.001 #relative permittivity of a medium
dn=35*10**-6 #vertical gradient of refractive index
Re=6370 #actual redius of earth
d=20 #transmitter and receiver distance in Km
d1=5
d2=15
K1=1.3333 #standard atmosphere condition
#Calculation
R=(er**0.5)/dn
K=R/(R-Re)
hm=(125*d**2)/(K*Re) #Earth bulge value in the middle of the path
h1=(500*d1*d2)/(K*Re) #h1
h2=(500*d1*d2)/(K1*Re) #h2
#Results
print'Bulge value = %.1f m'%hm
print'Bulge value, h1 = %.2f m'%h1
print'Bulge value, h2 = %.2f m'%h2
#Initialisation
K=1.33
d1=24 #heigth in Km
d2=15 #heigth in Km
K1=1
Re=6370 #actual redius of earth
#Calculation
R=4.12*(d1**0.5+d2**0.5)
R1=K1*Re
Rrh=(2*R1*d1)**0.5+(2*R1*d2)**0.5
#Results
print'K=1.33'
print'Rrh = %.1f km\n'%R
print'K=1'
print'Rrh = %.1f km'%Rrh #wrong answer in textbook
import math
#Initialisation
No=1 #index of refraction
N1=1.3*10**-7
h=20 #height
#Calculation
wc=math.asin(((4*No)/((4*No)+((h**2)*N1)))) #critical angle
#Results
print'Critical angle = %f'%wc #ans is not written in textbook
import math
#Initialisation
dn=-0.2 #air refractivity gradient
d=20 #height
b=0.074 #elevation angle from graph 3.10
f=7 #frequency in Ghz from graph 3.11
c=2*10**-6
#Calculation
t=0.156 #1000/6370
dm=dn+t
a=(-c*dm*d)**0.5 #elevation angle of waves
#Results
print'Elevation angle of waves = %.2f mrad'%(a*10**3)
print'Elevation angle = %.3f'%b #from graph 3.10
print'Minimum frequency of coupling waves into the duct = %d Ghz'%f #from graph 3.11
import math
#Initialisation
f=18 #frequency in GHz
d=30 #in km
R=25 #rainfall intensity in mm
#Using Table 3.3
av15=1.128
av20=1.065
av18=1.09
kv15=0.0335
kv20=0.0691
kv18=0.0587
#Calculation
yr=kv18*R**av18 #rain specific attenuation
de=(90*(90+d)**-1)*d
A=de*yr #Maximum rain attenuation
#Results
print'(1) Rain specific attenuation = %.2f dB/km'%yr
print'(2) Maximum rain attenuation = %.1f dB'%A
import math
#Initialisation
rh=-1
s=4 #sigma in S/m
f=5*10**9 #frequency in Hz
eo=8.85*10**-12 #permitivity of free space
er=75 #permitivity of medium
w1=30*3.14*180**-1 #in radians
#Calculation
w=2*math.pi*f
x=s*(w*eo)**-1
a=math.sin(w1)-math.sqrt((er-x)-math.cos(w1)**2)
a1=math.sin(w1)+math.sqrt((er-x)-math.cos(w1)**2)
rh1=a/a1
b1=(er-x)*math.sin(w1)-math.sqrt((er-x)-math.cos(w1)**2)
b2=(er-x)*math.sin(w1)+math.sqrt((er-x)-math.cos(w1)**2)
rv=-b1/b2
#Results
print'(2) X = %.1f'%x
print'(3) Rh = %.3f'%rh1
print' Rv = %.1f'%rv
import math
#Initialisation
f=5*10**9 #frequency in Hz
c=3*10**8 #speed of light
h1=6 #in metre
h2=2 #in metre
#Calculation
h=c*f**-1 #wavelength
w=math.atan(h1*2250**-1) #grazing angle in radian
w1=w*180*math.pi**-1 #grazing angle in degree
a=((2*math.pi*h1*h2)*(h*300)**-1)*3.14*180**-1
e=math.sin(a)
F=e*2*180*math.pi**-1 #PGF value (wrong calculated in textbook)
LR=20*math.log10(F) #Decrease in received signal level
#Results
print'(1) Grazing angle = %.2f degree'%w1
print'(2) PGF value = %f'%F #wrong value calculated in textbook
print'(3) Decrease in received signal level = %.2f dB'%LR #wrong value calculated in textbook
#Initialisation
h=12.5*10**-2 #in meter
d1=10*10**3 #in meter
d2=15*10**3 #in meter
d3=12.5*10**3 #in meter
d4=12.5*10**3 #in meter
h=1.25 #in Kilometer
#Calculation
r1=(((d1*d2)/(d1+d2))*h)**0.5 #radius of first and fourth Fresnel zones
r4=r1*(4)**0.5
R1=(((d3*d4)/(d3+d4))*h)**0.5 #radius of first and fourth ellipse zones
R4=R1*(4)**0.5
#Results
print'Radius of first fresnel zones, r1 = %.2f m'%r1
print'Radius of Second fresnel zones, r4= %.2f m'%r4
print'h = %.2f x 10^-4 Km'%h
print'Radius of first ellipse, R1 = %.2f m'%R1
print'Radius of second ellipse, R4 = %.1f m'%R4
import math
%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
#Initialisation
L=13200 #L parameter in m
H=10240 #H parameter
Re=6370000 #actual redius of earth
ht=30 #height in m
hr=20 #height in m
re1=8453000 # in metre
h1=30000 # in metre
h2=20000 # in metre
dt1=22.5
f=10*10**9 #frequency in Hz
c=3*10**8 #speed of light
d=30000 #distance in m
pt=30 #transmitter antenna power
gt=40 #transmitter antenna gain
gr=40 #receiver antenna gain
F3=-3
H=-34
D=0.75
#Calculation
dt=math.sqrt(2*re1*ht)
X=3*dt*L**-1
Z1=h1*H**-1
Z2=h2*H**-1
vx=10**-3.5 #from fig 3.26
z1=10**0.95 #from fig 3.27
z2=10**0.65 #from fig 3.27
#for d=3dt
lv=20*math.log10(vx)
lz1=20*math.log10(z1)
lz2=20*math.log10(z2)
F=(lv+lz1+lz2)*20**-1
F1=10**(F)
F11=20*math.log10(F1)
X1=2*dt*L**-1
d3=3
f3=-F11
vx1=10**-2.35 #from fig 3.26
lv1=20*math.log10(vx1)
#for d=2dt
F4=1+D
F5=20*math.log10(F4)
d2=2
f2=-F5
#for d=1.1dt
F6=math.sqrt(1+D**2)
F7=20*math.log10(F6)
d11=1.1
f11=-F7
#for d=dt
d1=1
f1=0.2
#for plotting graph in terms of points
for N in range(0,4,1):
a=plot(1,0.2,'-o')
a1=plot(1.1,-1.9,'-o')
a2=plot(2,-4.8,'-o')
a3=plot(3,-38,'-o')
plt.annotate('d/dt',xy=(1,2),xytext=(1, 2))
plt.annotate('1.1d/dt',xy=(1.2,0.7),xytext=(1.2, 0.7))
plt.annotate('2d/dt',xy=(2,-0.7),xytext=(2, -0.7))
plt.annotate('3d/dt',xy=(3,-35),xytext=(3, -35))
xlabel("$d/dt$")
ylabel("$20 log(F)$ (dB)")
title("Path gain F")
grid()
show(a)
show(a1)
show(a2)
show(a3)
h=c*f**-1 #wavelength
Pr=pt+gt+gr+H+F3-10*math.log10(4*math.pi*d**2) #Received signal power
#Results
print'(1) Effective receiver path gain F = %.4f'%F11
print'(2) Path gain F plot is shown'
print'(3) Received signal power Pr = %.1f dBm'%Pr
import math
#Initialisation
eirp=800 #in KW
d=24 #in Km
a=0.03 #in radian
d1=22 #in Km
d2=2 #in Km
h=0.4*10**-3 #wavelength in m
Er=45 #in microvolt
#Calculation
E=104.8+10*math.log10(eirp)-20*math.log10(d) #field intensity
V=a*math.sqrt((2*d2*d1)/((d1+d2)*h)) #knife edge obstacle attenuation
Lke=23 #from table 3.4
er=10**(Er*20**-1)
#Results
print'(1) Electric field intensity = %.3f microV/m'%er
#Initialisation
f1=430 #upper frequency band
f2=410 #lower frequency band
d=80 #distance in meter
#Calculation
Yv=0.1 #Specific attenuation obtained from graph fig 3.34
Lv=Yv*d #loss of forest trees
Am=((f1+f2)/2)**0.5 #maximum value for trees excess loss.
#Results
print'Specific attenuation index, Yv = %.1f dB/m'%Yv
print'Loss of forest trees, Lv = %.1f dB'%Lv
print'Maximum value for trees excess loss = %.1f dB'%Am
#Initialisation
d=40 #length in meter
Am=2 #area in square meter
f=10*10**9 #frequency in hertz
#Calculation
As=40 #using graph fig 3.36, As can be obtained
As1=30 #using graph fig 3.37, As can be obtained
#Results
print'Loss in the summer for trees with leaves, As = %d dB'%As
print'Loss in winter for trees without leaves, As = %d dB'%As1