from __future__ import division
from math import atan,degrees,sqrt,cos,pi,sin,exp,radians
#variable Declaration
f = 1.7 #frequency in MHz
f = 1.7*10**6 #frequency in Hz
E = 0.5 #electric field in mV/m
E = 0.5*10**(-3) # electric field in V/m
sigma = 5*10**-5 # conductivity in mho/cm
eta = 0.5 # efficiency
epsilon_r = 10 # relative permittivity
c = 3*10**8 # speed of light in m/s
lamda = c/f # wavelength in m
d = 10 # distance in km
d = 10*10**3 # distance in m
#calculations
Df = 1.8*10**12*(sigma/f) # dissipation factor
b = atan((epsilon_r+1)/Df)*180/pi # phase constant in degrees
p = (pi/Df)*(d/lamda)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-((sin(radians(b))*(sqrt(p/2)*(exp((-5*p)/8))))) # factor of the ground losses
# formula: E = (A*E_not)/d
#E_not = 300*sqrt(P_kW) # E_not is in mV/m
#E_not = 300*sqrt(P_kW)*10**(-3) # E_not is in V/m
P_kW = ((E*d*10**-3)/(A*300*10**-3))**2 # Power in kW and d is in km
# formula : P = Ptx*eta
Ptx = P_kW/eta #transmitter power required in kW
#result
print "transmitter power required in W:",round(Ptx*1000,2)
#note: answer in the book is wrong.python gives Ptx = 11.49W whereas answer in the book is Ptx = 12.6W
from __future__ import division
from math import sqrt,pi,radians,atan,cos,sin,exp
#variable Declaration
print "for frequency = 500kHz"
f1 = 500*10**3 # frequency in Hz
c = 3*10**8 # speed of light in m/s
lamda1 = c/f1 # wavelength in m
d = 100 # distance in km
d = 100*10**3 # distance in m
Pt = 100 # transmitter power in kW
eta = 50 # efficiency in percentage
eta = 0.5 # efficiency
P_kW = Pt*eta # radiated power in kW
E_not = 300*1.28*sqrt(P_kW) # field strength in mV/m without ground losses at 1km
#calculations and result
# for sea water earth
epsilon_r = 81 # permittivity
sigma = 45*10**-3 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f1) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda1)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b))*(sqrt(p/2)*exp((-5*p)/8))) # factor of the ground losses
E1 = (A*E_not)/(d) # in V/m
print "electric field strength for sea water earth in mV/m when f = 500kHz:",round(E1*1000,3)
# for good soil
epsilon_r = 20 # permittivity
sigma = 10**-4 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f1) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda1)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b))*(sqrt(p/2)*exp((-5*p)/8))) # factor of the ground losses
E2 = (A*E_not)/(d) # in V/m
print "electric field strength for good soil in mV/m when f = 500kHz:",round(E2*1000,3)
# for poor soil
epsilon_r = 10 # permittivity
sigma = 0.2*10**-4 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f1) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda1)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b))*(sqrt(p/2)*exp((-5*p)/8))) # factor of the ground losses
E3 = (A*E_not)/(d) # in V/m
print "electric field strength for poor soil in mV/m when f = 500kHz:",round(E3*1000,3)
# for cities,industrial areas
epsilon_r = 5 # permittivity
sigma = 10**-5 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f1) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda1)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b))*(sqrt(p/2)*exp((-5*p)/8))) # factor of the ground losses
E4 = (A*E_not)/(d) # in V/m
print "electric field strength for cities,industrial areas in mV/m when f = 500kHz:",round(E4*1000,3)
# for Rockey soil,flat sandy
epsilon_r = 10 # permittivity
sigma = 2*10**-3 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f1) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda1)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b))*(sqrt(p/2)*exp((-5*p)/8))) # factor of the ground losses
E5 = (A*E_not)/(d) # in V/m
print "electric field strength for Rockey soil,flat sandy in mV/m when f = 500kHz:",round(E5*1000,3)
# for medium hills,forestation
epsilon_r = 13 # permittivity
sigma = 5*10**-5 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f1) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda1)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b))*(sqrt(p/2)*exp((-5*p)/8))) # factor of the ground losses
E6 = (A*E_not)/(d) # in V/m
print "electric field strength for medium hills,forestation in mV/m when f = 500kHz:",round(E6*1000,3)
print("for frequency = 1500kHz")
f2 = 1500 # in kHz
f2 = 1500*10**(3) # in Hz
lamda2 = c/f2 # in m
# for sea water earth
epsilon_r = 81 # permittivity
sigma = 45*10**-3 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f2) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda2)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b)))*(sqrt(p/2)*exp((-5*p)/8)) # factor of the ground losses
E1 = (A*E_not)/(d) # in V/m
print "electric field strength for sea water earth in mV/m when f = 1500kHz:",round(E1*1000,3)
# for good soil
epsilon_r = 20 # permittivity
sigma = 10**-4 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f2) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda2)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b)))*(sqrt(p/2)*exp((-5*p)/8)) # factor of the ground losses
E2 = (A*E_not)/(d) # in V/m
print "electric field strength for good soil in mV/m when f = 1500kHz:",round(E2*1000,3)
# for poor soil
epsilon_r = 10 # permittivity
sigma = 0.2*10**-4 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f2) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda2)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b)))*(sqrt(p/2)*exp((-5*p)/8)) # factor of the ground losses
E3 = (A*E_not)/(d) # in V/m
print "electric field strength for poor soil in mV/m when f = 1500kHz:",round(E3*1000,3)
# for cities,industrial areas
epsilon_r = 5 # permittivity
sigma = 10**-5 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f2) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda2)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b)))*(sqrt(p/2)*exp((-5*p)/8)) # factor of the ground losses
E4 = (A*E_not)/(d) # in V/m
print "electric field strength for cities,industrial areas in mV/m when f = 1500kHz:",round(E4*1000,3)
# for Rockey soil,flat sandy
epsilon_r = 10 # permittivity
sigma = 2*10**-3 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f2) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda2)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b)))*(sqrt(p/2)*exp((-5*p)/8)) # factor of the ground losses
E5 = (A*E_not)/(d) # in V/m
print "electric field strength for Rockey soil,flat sandy in mV/m when f = 1500kHz:",round(E5*1000,3)
# for medium hills,forestation
epsilon_r = 13 # permittivity
sigma = 5*10**-5 # conductivity in mho/cm
Df = 1.8*10**12*(sigma/f2) # dissipation factor
b = atan(radians(epsilon_r+1)/Df) # phase constant in degrees
p = (pi/Df)*(d/lamda2)*cos(radians(b)) # numerical distance
A = ((2+0.3*p)/(2+p+0.6*p**2))-(sin(radians(b))*(sqrt(p/2))*exp((-5*p)/8)) # factor of the ground losses
E6 = (A*E_not)/(d) # in V/m
print "electric field strength for medium hills,forestation in mV/m when f = 1500kHz:",round(E6*1000,3)
# note 1 : misprint value of sigma in part (e) when f = 500khz correct is sigma = 2*10**-3 for rockey soil
# note 2: The ans is rounded off at the F = 1500 kHz in poor soil and Cities, industrial area.
# note 3 : most of the answers in the book are upto one places of decimal.python calculated them upto 3 places of decimal.
# note 4 : Several answers in the book are not correctly calculated after decimal.
from __future__ import division
from math import sqrt
#variable Declaration
Ht=100 # height of transmittin antenna in feet
Hr=50 # height of receiving antenna in feet
#calculation
Dmax = sqrt(2*Ht)+sqrt(2*Hr) # in miles
#result
print "maximum range of tropospheric transmission in miles:",round(Dmax,3)
from __future__ import division
from math import sqrt
#variable Declaration
Ht=80 # height of transmitting antenna in meter
#calculation
d=sqrt(17*Ht) # radio horizon distance of transmitting antenna
#result
print "radio horizon distance of transmitting antenna in Km",round(d,3)
from __future__ import division
from math import sqrt
#variable Declaration
Ht=80 # height of transmittin antenna in meter
Hr=50 # height of receiving antenna in meter
#calculation
dmax = sqrt(17*Ht)+sqrt(17*Hr) # in miles
#result
print "maximum range of tropospheric transmission in Km:",round(dmax,3)
from __future__ import division
from math import sqrt
#variable Declaration
Dmax = 80 #distance in Km
Ht = 100 # height of transmitting antenna in meter
#calculations
# formula : Dmax = sqrt(17*Ht)+sqrt(17*Hr)
Hr = ((Dmax-(sqrt(17*Ht)))**2)/17 # height of receiving antenna in m
#result
print "height of receiving antenna in m",round(Hr,3)
from __future__ import division
from math import sqrt
#variable Declaration
Ht=300 # height of antenna in feet
Hr=100 # height of receiving antenna in feet
#calculations
dt=sqrt(2*Ht) # radio horizon distance for a transmitting antenna in miles
dr=sqrt(2*Hr) # radio horizon distance for a transmitting antenna in miles
dmax=dt+dr # maximum range of space wave propagation in miles
#result
print "radio horizon distance for a transmitting antenna in miles:",round(dt,3)
print "radio horizon distance for a receiving antenna in miles:",round(dr,3)
print "maximum range of space wave propagation in miles:",round(dmax,3)
from __future__ import division
from math import sqrt,pi
#variable Declaration
f = 60 # in MHz
f = 60*10**6 # in Hertz
c = 3*10**8 # speed of light in m/s
lamda = c/f # wavelength in meter
Ptx = 1 # transmitting power in kilo watt
ht = 50 # height of transmiting antenna in meter
hr = 5 # height of receiving antenna in meter
E = 80 # electric field in micro V/m
E = 80*10**(-6) # electric field in V/m
#calculations
E0 = 3*137.6*sqrt(Ptx)*(8/5)*10**3 # field in mV/m at 1 meter where Ptx is in kW
E0 = 3*137.6*sqrt(Ptx)*(8/5)*10**3*10**(-3) # field in V/m at 1 meter where Ptx is in kW
# formula : E = (4*(pi)*ht*hr*E0)/(lambda*d**2)
d = sqrt((4*pi*ht*hr*E0)/(lamda*E)) # range of space wave in meter
#result
print "range of space wave in Km:",round(d/1000,3)
from __future__ import division
from math import sqrt
#variable Declaration
hd = 30 # height of duct in m
delta_M = 30 # unitless
#calculations
lamda_max = 2.5*hd*sqrt(delta_M*10**-6) # maximum wavelength at which duct propagation is possible
#result
print "maximum wavelength at which duct propagation is possible in m:",round(lamda_max,3)
from __future__ import division
#variable Declaration
fc = 1.5 # critical frequency in MHz
fc = 1.5*10**(6) # critical frequency in Hz
#calculations
# formula : fc = 9*sqrt(Nmax)
Nmax = (fc)**2/81 # electron density in electrons/m**3
#result
print "electron density in electrons/m**3:",Nmax
from __future__ import division
from math import sqrt
#variable Declaration
n = 0.92 # refrective index
MUF = 10 # maximum usable frequency in MHz
MUF = 10*10**6 # maximum usable frequency in Hz
f = 10*10**6 # in Hz ordinary frequency and maximum usable frequency are same
h = 400 # height of ray reflection point on the ionospheric layer in Km
h = 400*10**3 # height of ray reflection point on the ionospheric layer in m
#calcu;ations
# formula :n = sqrt(1-(81*Nmax/f**2))
Nmax = (1-n**2)*f**2/81 # electron density in electrons/m**3
fc = 9*sqrt(Nmax) # critical frequency in Hz
# MUF = fc*sec(thetai)
#sec(thetai) = MUF/fc
# also, sec(thetai) = sqrt(h**2+(d**2/4))/h so on comparing,
d = sqrt(((MUF*h/fc)**2-h**2)*4) # range in km
#result
print "Range in Km:",round(d/1000,3)
# note :answer in the book is 1876.59 where as in python is 1877.94 minute difference only
from __future__ import division
from math import sqrt
#variable Declaration
f=50 # in hz
f=50*10**3 # in KHz
N1=400 # electron density of D layer in electrons/cm**3
N2=5*10**5 # electron density of E layer in electrons/cm**3
N3=2*10**6 # electron density of F layer in electrons/cm**3
#calculations
# formula :n=sqrt(epsilon_r)=sqrt(1-(81*N/f**2)) # WHERE f IS IN KhZ
# for D layer
epsilon_r1=1-(81*N1/f**2) # relative permittivity of D layer
# for E layer
epsilon_r2=1-(81*N2/f**2) # relative permittivity of E layer
# for F layer
epsilon_r3=1-(81*N3/f**2) # relative permittivity of F layer
#result
print "relative permittivity of D layer:",round(epsilon_r1,3)
print "relative permittivity of E layer:",round(epsilon_r2,4)
print "relative permittivity of F layer:",round(epsilon_r3,4)
from __future__ import division
from math import sqrt,radians,asin,sin,pi,degrees
#variable Declaration
f = 50 # in hz
f = 50*10**3 # in KHz
theta_i = 30 # in degrees
N = 400 # electron density of D layer in electrons/cm**3
#calculations
# formula :n = sqrt(epsilon_r) = sqrt(1-(81*N/f**2)) # WHERE f IS IN KhZ
# for D layer
epsilon_r = 1-(81*N/f**2) # relative permittivity of D layer
n = sqrt(epsilon_r) # refrective index
# formula : nsin(theta_r) = sin(theta_i) # snell's law
theta_r = asin(sin(radians(theta_i/n)))*180/pi # angle of refraction in degrees
#result
print "angle of refraction in degrees:",round(theta_r,3)
from __future__ import division
from math import sqrt
#variable Declaration
N1 = 400 # electron density of D layer in electrons/cm**3
N2 = 5*10**5 # electron density of E layer in electrons/cm**3
N3 = 2*10**6 # electron density of F layer in electrons/cm**3
#calculations
# formula : fc = 9*sqrt(N)
fc1 = 9*sqrt(N1) # critical frequency in Khz of EM wave for D layer
fc2 = 9*sqrt(N2) # critical frequency in MHz of EM wave for E layer
fc3 = 9*sqrt(N3) # critical frequency in MHz of EM wave for F layer
#result
print "critical frequency of EM wave for D layer in kHz:",round(fc1,3)
print "critical frequency of EM wave for E layer in Mhz:",round(fc2/10**3,3)
print "critical frequency of EM wave for F layer in Mhz:",round(fc3/10**3,3)
#note: the value of fc3 in book is equal to 12.8MHz but the correct is 12.72MHz.
from __future__ import division
from math import sqrt
#variable Declaration
Nmax = 1.3*10**6 # maximum electron density in electrons/cm**3
#calculations
# formula : fc = 9*sqrt(Nmax)
fc_khz = 9*sqrt(Nmax) # critical frequency in Khz
#result
print "critical frequency in Mhz:",round(fc_khz/1000,3)
from __future__ import division
from math import sqrt
#variable Declaration
d = 2600 # distance between the points in Km
d = 2600*10**3 # distance between the points in m
fc = 4 # critical frequency in MHz
fc = 4*10**6 # critical frequency in Hz
h = 200 # height of ionospheric layer in km
h = 200*10**3 # height of ionospheric layer in m
#calculations
MUF = fc*sqrt(1+(d/(2*h))**2) # maximum usable frequency (this step is Misprinted in the book)
#result
print "maximum usable frequency in MHz:",round(MUF/10**6,3)
#note: Answer in the book is wrong.
from __future__ import division
from math import sqrt
#variable Declaration
N = 400 # electron density in electrons/cm**3
n = 0.5 # refrective index
#calculations
# formula : n = sqrt(1-(81*N/f**2))
f = sqrt(81*N/(1-n**2)) # frequency in kHz
#result
print "frequency of propagating wave in kHz:",round(f,3)
from __future__ import division
from math import sqrt
#variable Declaration
Ht = 60 # height of transmitting antenna in meter
Hr = 6 # height of receiving antenna in meter
#calculations
d= sqrt(17*Ht)+sqrt(17*Hr) # in Km
#result
print "range of line of sight in Km:",round(d,3)
from __future__ import division
from math import sqrt,asin,atan,pi
#variable Declaration
d=500 # distance between transmitter and receiver in km
h=70 # height of D layer in km
#calculations
theta_c = asin(h/(sqrt(h**2+(d**2/4))))*180/pi # critical angle in degrees
#result
print "critical angle of propagation in degrees:",round(theta_c,3)
#it can also be calculated from
theta_c = atan((2*h/d))*180/pi # critical angle in degrees
print "critical angle of propagation in degrees by method 2:",round(theta_c,3)