#calculate radio horizon and the maximum distance of propagation of the TV signal
from math import sqrt
#Variable declaration
ht = 144 #transmitter antenna height(m)
hr = 25 #receiving antenna height(M)
#Calculations
dt = 4*sqrt(ht)
dr = 4*sqrt(hr)
d = dt+dr
#Results
print "Radio horizon is",dt,"km"
print "The maximum distance of propagation of the TV signal is",d,"km"
#calculate horizon distance of the transmitter
from fractions import Fraction
#Variable declaration
r = 6370*10**3 #radius of earth(km)
du_dh = -0.05*10**-6 #refractive index of air near ground
#Calculations
k = 1/(1+(r*du_dh))
#Result
print "The horizon distance of the transmitter can be modified by replaing r by r' is",round(k,3),"r"
#calculate carrier tansmitted power required
import math
#Variable declaration
c = 3.*10**8 #velocity of propagation(m/s)
f = 2*10**9 #frequency(Hz)
r = 50*10**3 #repeater spacing(km)
Pr = 20 #carrier power(dBm)
Gt = 34 #antenna gain(dB)
L = 10 #dB
Gr = 34 #dB
#Calculations
lamda = c/f
Pt = -Pr+(10*math.log10(4*math.pi*r**2))-Gt-(10*math.log10(lamda**2/(4*math.pi)))+L-Gr
#Results
print "The carrier tansmitted power required is",round(Pt,1),"dBm"
#calculate Received power
import math
#Variable declaration
f = 6.*10**9 #uplink frequency(Hz)
e = 5 #elevation angle(degrees)
Pt = 1.*10**3 #transmitter power(W)
Gt = 60. #gain of transmitter(dB)
Gr = 0 #gain of receiver(dB)
d = 36000*10**3 #distance between ground and satellite(m)
c = 3.*10**8 #velocity of propagation(m/s)
#Calculation
Gt1 = 10**(Gt/10)
Gr1 = 10.**(Gr/10)
r = d/(math.sin(math.radians(e)))
lamda = c/f
Pr = (Pt*Gt1*Gr1*lamda**2)/(4*math.pi*r**2*4*math.pi)
#Result
print "Received power =",round((Pr/1E-14),1),"*10^-14 W"
#calculate Antenna beam angle
import math
#Variable declaration
r = 6371 #radius of the earth(km)
#Calculation
d = 35855+r #distance of satellite from center of the earth(km)
b = (math.degrees(math.pi)*r)/d
#Result
print "Antenna beam angle =",round(b,2),"degrees"
#calculate round trip time between earth station and satellite,round trip time for vertical transmission
import math
#Variable declaration
r = 6371 #radius of earth(km)
h = 35855 #height(km)
phi = 5 #elevation angle(degrees)
c = 3*10**8 #velocity of propagation(m/s)
B = 90 #angle for vertical transmission(degrees)
#Calculations
d = math.sqrt(((r+h)**2)-((r*math.cos(math.radians(phi)))**2))- (r*math.sin(math.radians(phi)))
T = (2*d*10**3)/c
dv = math.sqrt(((r+h)**2)-(r**2))
Tv = (2*(dv-r)*10**3)/c
#Results
print "The round trip time between earth station and satellite is",round((T/1E-3)),"msec"
print "The round trip time for vertical transmission is",round((Tv/1E-3)),"msec"
#calculate figure of merit for earth station
import math
#Variable declaration
Tant = 25 #effective noise temperature for antenna(K)
Tr = 75 #receiver oise temperature(K)
G = 45 #power gain(dB)
#Calculations
T = Tant+Tr
Tdb = 10*math.log10(T)
M = G - Tdb
#Results
print "The figure of merit for earth station is",M,"dB"
#calculate carrier to noise ratio
#Variable declaration
EIRP = 55.5 #satellite ESM(dBW)
M = 35 #freespace loss(dB)
Lfs = 245.3 #GT of earth station(dB)
#Calculation
C_No = EIRP + M - Lfs + 228.6
#Result
print "The carrier to noise ratio is",round(C_No,2),"dB"
#calculate system noise temperature
import math
#Variable declaration
D = 30 #diameter of dish(m)
f = 4*10**9 #downlink frequency(Hz)
M = 20 #G/T ratio of earth station
c = 3.*10**8 #velocity of propagation(m/s)
#Calculations
Ae = (math.pi*D**2)/4
lamda = c/f
G = (4*math.pi*Ae)/lamda**2
Gdb = 10*math.log10(G)
Ts = Gdb - M
#Result
print "The system noise temperature is",round(Ts),"dB"
#chapter-10 page 489 example 10.10
#calculate Diameter of the circular mouth of a parabolic antenna, Half Power BeamWidth of the antenna
#For a parabolic antenna
import math
Gp=1500.;#Power gain
w=0.1;#wavelength in m
#CALCULATION
D=math.sqrt(Gp)*(w/(math.pi));#Diameter of the circular mouth of a parabolic antenna in m
HPBW=58*(w/D);#Half Power BeamWidth of the antenna in deg
#OUTPUT
print '%s %.4f %s %s %.3f %s'%('\nDiameter of the circular mouth of a parabolic antenna is D=',D,'m','\nHalf Power BeamWidth of the antenna is HPBW=',HPBW,'deg');
#chapter-10 page 490 example 10.11
#calculate Overall gain that can be expected, Overall gain of the system
import math
D=1.;#Assume diameter of the parabolic reflectors in the original system in m
w=1.;#Assume wavelength in m
#CALCULATION
D1=2.*D;#diameter of the parabolic reflectors in the modified system in m
G=6.*(D/w)**2.;#gain in original system
G1=6.*(D1/w)**2.;#gain in modified system
GdB=10.*math.log10(G1/G);#Overall gain that can be expected in dB
GdBo=2.*GdB;#Overall gain of the system(combining the two antennas one at the Tx and other at the Rx) in dB
#OUTPUT
print '%s %.f %s %s %.f %s' %('\nOverall gain that can be expected is GdB=',GdB,'dB', '\nOverall gain of the system(combining the two antennas one at the Tx and other at the Rx) is GdBo=',GdBo,'dB');
#Note: Check the answer once ..it should be GdB=10log(4)=6 dB and GdBo=12dB
#chapter-10 page 490 example 10.12
#calculate a)beamwidth between first nulls
#calculate b)beamwidth between half power points
D=3.##dimension of a paraboloid in m
f=3.*10.**9.##frequency (S band) in Hz
c=3.*10.**8.##Velocity of light in m/sec
#CALCULATION
w=c/f##wave length in m
BWFN=140.*(w/D)##BeamWidth between First Nulls in deg
BWHP=70.*(w/D)##BeamWidth between HalfPower points in deg
G=6.*(D/w)**2.##Gain of the antenna
#OUTPUT
print '%s %.2f %s %s %.2f %s %s %.f' %('BeamWidth between First Nulls is BWFN=',BWFN,'deg','\nBeamWidth between HalfPower points is BWHP=',BWHP,'deg','\nGain of the Antenna is G=',G)#
#calculate power gain of optimum horn antenna
#Variable declaration
A = 5
#Calculation
Gp = 4.5*A**2
#Result
print "Power gain of optimum horn antenna =",Gp