import math
#Initialisation
f=5 #frequency in Hz
er=15 #ground characteristics
s=0.01 #for vertically polarized waves
c=3*10**8 #speed of light
e0=8.85*10**-12 #permitivity of free space
d=80000 #distance in m
#Calculation
a=5**0.333
df=50/a #distance in metre
h=c*(f*10**6)**-1 #wavelength
b=s/(2*math.pi*f*e0*10**6)
b1=math.sqrt(er**2+b**2)
p=(math.pi*d)/(h*b1)
#from fig 5.8
As = 0.05 #attenuation factor
#Results
print'p = %d'%p
print'|As| = %.2f'%As
import math
#Initialisation
c=3*10**8 #speed of light
f=10*10**6 #frequency in Hz
e0=8.85*10**-12 #permitivity of free space
er=10 #ground characteristics
s=0.005
d=30000
pt=200 #transmitter power in watt
gt=1 #gain of transmitter antenna
gr=1 #gain of receiver antenna
#Calculation
h=c*f**-1 #wavelength
e=er*e0
b=s/(2*math.pi*f*e)
b1=math.sqrt(er**2+b**2)
p=(math.pi*d)/(h*b1) #wrong value calculated in textbook
i=((er*e0*2*3.14*f)/s)
b2=math.atan(i)
b3=b2*180/math.pi
a1=((2+0.3*p)/(2+p+0.6*p**2))
a2=math.sqrt(p/2)*(5*10**-82)*math.sin(-b3)
As=a1-a2 #attenuation function
pr=pt*gt*gr*h**2/(4*math.pi*d)**2
pr1=pr*(2*As)**2 #wrong value calculated in textbook
#Results
print'Received signal power Pr = %.2f pW'%(pr1*10**12) #wrong value calculated in textbook
import math
#Initialisation
f=0.5 #frequency in MHz
Pa=100 #transmitter power
Po=1000
e120=68 #from figure 5.10
e220=85 #from figure 5.9
e230=80
e330=60 #from figure 5.10
e380=48
e350=50 #from figure 5.10
e250=75 #from figure 5.9
e260=73
e160=60 #from figure 5.10
e180=48
#Calculation
ETR=e120-e220+e230-e330+e380
ERT=e350-e250+e260-e160+e180 #wrong value calculated in textbook
ER=(ETR+ERT)/2 #field strength at the receiving end
Ea=ER+(10*math.log10(Pa*Po**-1))
lb=137.2+(20*math.log10(f))-ER
#Results
print'(1) Electric field = %.1f dB'%Ea #wrong value calculated in textbook due to value ER
print'(2) Basic loss path = %.1f dB'%lb #wrong value calculated in textbook due to value ER
import math
#Initialisation
f1=2.5 #frequency in MHz
f2=6.3 #frequency in MHz
K=1.1 # K factor
#Calculation
fse=1.05*f1*2 #frequency in MHz
fsf=K*f2*2 #frequency in MHz
#Results
print'Frequency for E layer = %.2f MHz'%fse
print'Frequency for F layer = %.2f MHz'%fsf
import math
#Initialisation
f=10 #frequency in MHz
delta=14.5 #in degree
d=1750 #distance in Km
re=6370 #radius of earth in Km
pt=100 #transmitter power in watt
lm=30 #in dB
P11=3775 #in Km
#Calculation
a=(delta+(d/(2*re)))*(180*3.14**-1)
j=math.cos(a)
a1=(d*(2*re)**-1)*(180*3.14**-1)
j1=math.sin(a1)
P=4*re*(j1*j**-1) #path length
pt1=10*math.log10(pt*10**-3)
FSL=32.4+20*math.log10(f)+20*math.log10(3775) #free space loss
Et=136.6+pt1+20*math.log10(f)-FSL-lm #median value
#Results
print'(1) Path length = %d km'%P11
print'(2) Median value = %.2f dB'%Et
import math
#Initialisation
et=20 #in dB
gr=2 #antenna gain in dB
f=15 #frequency in MHz
#Calculation
pr=et+gr-(20*math.log10(f))-107.2 #received signal power in dB
pr1=10**(pr/10) #received signal power in W
#Results
print'Power Recieved signal = %.2f pW'%(pr1*10**12)
import math
#Initialisation
pr=-108.7 #received signal power in dB
fa=50 #noise tempreture
b=2700 #frequency in Hz
N=5 #noise figure in dB
#Calculation
snr=pr-fa-(10*math.log10(b))+204 #signal to noise ratio
snr1=snr-N
#Results
print'Received signal to noise ratio = %.1f dB'%snr
print'Output signal to noise ratio = %.1f dB'%snr1
import math
#Initialisation
d=3000 #distance in Km
re=6370 #radius of earth in Km
phi=72 #angle in degree
N=5*10**11 #electron density
#Calculation
teta=3000*(2*6370)**-1 #in radian
teta1=teta*180/math.pi #degree
dt=90-teta1-phi #Elevation angle
a=re/(math.sin(phi*math.pi/180))
b=math.sin((teta1+phi)*math.pi/180)
h=(a*b)-re #Height in Km
fc=9*math.sqrt(N) #frequency in MHz
MUF=fc*(math.cos(phi*math.pi/180))**-1 #Maximum working frequency
#Results
print'(1) Elevation angle = %.1f degree'%dt
print'(2) Height h = %.1f km'%h
print'(3) MUF = %.1f MHz'%(MUF*10**-6)
import math
#Initialisation
d=2500 #distance in Km
re=6370 #radius of earth in Km
dt=6 #elevation angle in degree
f1=15 #frequency in MHz
los1=42 #loss
#Calculation
teta=d*(2*re)**-1 #in radian
teta1=teta*180/math.pi #in degree
phi=90-dt-teta1
l=(2*re*math.sin(teta))/math.sin(phi*math.pi/180)
fsl=32.4+(20*math.log10(f1))+(20*math.log10(l)) #Free space loss
pr=57+6-fsl-los1 #receving power in dB
pr1=10**(pr/10) #receving power in Watt
#Results
print'Power = %.2f pW'%(pr1*10**12)