#program to compute directivity , radiation intensity,F,the effective area.
from sympy import symbols,conjugate,integrate,sin,I,exp,pi
Etheta,Hphi,ko,no,Io,l,r,theta,C,phi,lamda=symbols('Etheta,Hphi,ko,no,Io,l,r,theta,C,phi,lamda')
Etheta=((I*ko*no*Io*l)/(4*pi*r))*sin(theta)*exp(-I*ko*r);
Hphi=((I*ko*Io*l)/(4*pi*r))*sin(theta)*exp(-I*ko*r);
F=(r**2)*(Etheta*conjugate(Hphi));
Prad=C*integrate(integrate(sin(theta)**3,(theta,0,pi)),(phi,0,2*pi));
Prad=8*pi*C/3;
D=4*pi*C/Prad;
Ac=((lamda**2)*D)/(4*pi);
print "the radiation intensity is given by = ",F
print "directivity is given by = ",D
print "the effective area of the dipole = ",Ac
# program to find the reactive power in dbm.
from math import pi,log10
Pt=120;f=6*10**9;
Gt =10**4.2; Gr =10**3.1;
lamda=0.05;R=3.59*10**7;
Pr=(Pt*Gt*Gr*(lamda**2))/((4*pi*R)**2);
Pr=10*log10(Pr/0.001);
print "received power in dBm will be = %.2f"%Pr
# program to calculate the input and output SNR.
from math import log10
f=4*10**9;B=1*10**6;Grf=10**2;Gif=10**3;
Lt=10**0.15;Lm=10**0.6;To=290;
Fm=10**0.7;Tm=(Fm-1)*To;Tp=300;Tb=200;eta=0.9;
Frf=10**0.3;Fif=10**0.11;k=1.38*10**-23;
Trf=(Frf-1)*To;
Tif=(Fif-1)*To;
Trec=Trf+(Tm/Grf)+((Tif*Lm)/Grf);
Ttl=(Lt-1)*Tp;
Ta=eta*Tb+(1-eta)*Tp;
Ni=k*B*Ta;
Ni=10*log10(Ni/0.001); # converting in to dBm.
si=-80; # in dBm.
SNRi=si-Ni; # input SNR.
Tsys=Ta+Ttl+Lt*Trec;
SNRo=si-10*log10((k*B*Tsys)/0.001);
print "input SNR in dB = %.2f"%SNRi
print "output SNR in dB = %.2f"%SNRo
# program to find the maximum range of radar.
from math import pi
G=10**2.8;Pt=2000;sigma=12;
Pmin =10**-12; lamda =0.03;
Rmax=((Pt*(G**2)*sigma*(lamda**2))/(((4*pi)**3)*Pmin))**(0.25);
print "the maximum range of the radar in meter = %.2f"%Rmax
# program to find the J/S ratio.
from math import pi,log10
Gr=3162;Pj=1000.;R=3000.;Br=1e6;Bj=20e6;
Gj=10.;lamda=0.03;Pt=1e5;sigma=4.;Rj=10000.;
x=(Pj/Pt)*((4.*pi*(R**2)*Gj)/(sigma*Gr))*(Br/Bj); #x=J/S
x=10.*log10(x);
Grsl=10**(3.5-2);# radar anteena gain in its sidelobe region .
x1=(Pj/Pt)*(((R**4)*Gj*Grsl)/((Gr**2)*(Rj**2)))*(Br/Bj) ;
#x1=10*log10(x1);
print "THE J/S ration for the SSJ case in dB is = %.2f"%x
print "THE J/S ratio for the SOJ case in dB is = %.2f"%x1
# program to calculate the power density of 20 m from the anteena .
from math import pi
G=10**4;Pin=5;R=20;
S=(Pin*G)/(4*pi*(R**2))*0.1;
print "the power density in the main beam of the anteena at a distance of 20 m in mw/cmˆ2 = %.1f"%S