#(a) Calculate the cyclotron angular frequency
em=1.759*(10**11) #em=e/m is the charge is to mass ratio of electron
B0=0.336 #Magnetic flux density in Wb/m**2
wc=(em)*B0
print"The cyclotron angular frequency(in rad)is =","{:.2e}".format(wc),"rad"
#(b) Calculate the cutoff voltage for a fixed B0
a=5*(10**-2) #radius of cathode cylinder in meter
b=10*(10**-2) #radius of vane edge to center in meter
Voc=(em*(B0**2)*(b**2)*((1-((a/b)**2))**2))/8
Voc=Voc/(10**5) #converting Voc in KV
print"The cutoff voltage for a fixed B0(in KV)is =",round(Voc,2),"KV" #calculation mistake in book
#(c) Calculate the cutoff magnetic flux density for a fixed V0
V0=26*(10**3) #Anode voltage in volt
Boc=sqrt((8*V0)/em)/(b*(1-((a/b)**2)))
Boc=Boc*1000 #converting Boc in mWb/m**2
print"The cutoff magnetic flux density for a fixed V0(in mWb/m**2)is =",round(Boc,3),"mWb/m2"
import math
#(a) Calculate the angular resonant frequency
f=9*(10**9) #Operating frequency in Hertz
wr=2*math.pi*f #angular frequency
print"The angular resonant frequency(in rad)is =","{:.3e}".format(wr),"rad"
#(b) Calculate the unloaded quality factor
C=2.5*(10**-12) #vane capacitance in Farad
Gr=2*(10**-4) #Resonator conductance in mho
Qun=wr*C/Gr
print"The unloaded quality factor is=",int(round(Qun))
#(c) Calculate the loaded quality factor
C=2.5*(10**-12) #vane capacitance in Farad
Gr=2*(10**-4) #Resonator conductance in mho
Gl=2.5*(10**-5) #loaded conductance in mho
Ql=wr*C/(Gl+Gr)
print"The loaded quality factor is=",int(Ql)
#(d) Calculate the external quality factor
C=2.5*(10**-12) #vane capacitance in Farad
Gl=2.5*(10**-5) #loaded conductance in mho
Qex=wr*C/Gl
print"The external quality factor is=",int(round(Qex))
#(e) Calculate the circuit efficiency
n=(1/(1+(Qex/Qun)))
n=n*100
print"The circuit efficiency(in %) is=",round(n,2),"%"
#(f) Calculate the electronic efficiency
V0=5.5*(10**3) #Anode Voltage in volt
I0=4.5 #Beam current in Ampere
Plost=18.5*(10**3) #power loss in Watt
ne=((V0*I0)-(Plost))/(V0*I0)
ne=ne*100
print"The electronic efficiency(in %) is=",round(ne,2),"%"
#(a) Calculate the Hull cutoff voltage for fixed Bo
em=1.759*(10**11) #em=e/m is the charge to mass ratio of electron
Bo=0.01 #Magnetic flux density in Wb/m**2
d=5*(10**-2) #Distance between cathode and anode in meter
Voc=(1.0/2)*(em)*(Bo**2)*(d**2)
Voc=Voc/1000 #converting Voc in KV
print"The Hull cutoff voltage for fixed Bo (in KV)is =",round(Voc),"KV"
#(b) Calculate the Hull cutoff magnetic field density for fixed Vo
V0=10*(10**3) #Anode voltage in Volt
Boc=(1.0/d)*sqrt((2*V0)/(em))
Boc=Boc*1000 #in mWb/m2
print"The Hull cutoff magnetic field density for fixed Vo(in mWb/m**2)is =",round(Boc,2),"mWb/m2"
#(a) Calculate the electron velocity at the hub surface
em=1.759*(10**11) #em=e/m is the charge to mass ratio of electron
Bo=0.015 #Magnetic flux density in Wb/m**2
d=5*(10**-2) #Distance between cathode and anode in meter
h=2.77*(10**-2) #hub thickness in meter
V=em*Bo*h
print"The electron velocity at the hub surface(in m/s)is =","{:.1e}".format(V),"m/s" #answer in book is wrong
#(b) Calculate the phase velocity for synchronism
Vph=V #Vph=W/B and for synchronism Vph=V
print"The phase velocity for synchronism is Vph=w/B =","{:.1e}".format(Vph),"m/s"
#(c) Calculate the Hartree anode voltage
Vph=int(Vph/1000000) #converting the Vph in to the format printed above for easy calculations
Vph=Vph*1000000
Voh=((Vph*Bo*d))-((1.0/2)*(1/em)*(Vph**2))
Voh=Voh/1000 #in KV
print"The Hartree anode voltage (in KV) is =",round(Voh,2),"KV"
#(a) Calculate the cutoff voltage for fixed Bo
em=1.759*(10**11) #em=e/m is the charge to mass ratio of electron
Bo=0.01 #Magnetic flux density Wb/m**2
a=3*(10**-2) #anode radius in meter
b=4*(10**-2) #Cathode radius in meter
Voc=(1.0/8)*(em)*(Bo**2)*(a**2)*((1-((b/a)**2))**2)
Voc=Voc/1000 # in KV
print"The cutoff voltage for fixed Bo(in KV)is =",round(Voc,2),"KV"
#(b) Calculate the cutoff magnetic flux density for fixed Vo
V0=10*(10**3) #Anode voltage in Volt
Boc=(-1/(sqrt(em)))*(sqrt(8*V0))/((a)*(1-((b/a)**2)))
print"The cutoff magnetic flux density for fixed Vo(in Wb/m**2)is =",round(Boc,4),"Wb/m2"
#(a) Calculate the agile excursion
t=0.2*(10**-6) #pulse duration in seconds
N=14 #pulse rate on target per scan
AC=N/t #agile Excursion
AC=AC/(10**6) #in MHz
print"The agile excursion(in MHz)is =",int(AC),"MHz"
#(b) Calculate the pulse-to-pulse frequency separation
fp=1.0/t
fp=fp/(10**6) #in MHz
print"The pulse-to-pulse frequency separation(in MHz)is =",int(fp),"MHz"
#(c) Calculate the signal frequency
DC=0.001 #Duty cycle
f=(DC/t)
f=f/(10**3) #in KHz
print"The signal frequency(in KHz)is =",int(f),"KHz"
#(d) Calculate the time for N pulses
Time=N/f
print"The time for 14 pulses per second (in ms)is =",Time,"ms"
#(e) Calculate the agile rate
Agile_rate=1/(2*Time*(10**-3))
print"The agile rate(in Hz)is =",round(Agile_rate,2),"Hz"
#(a) Calculate the induced RF power
Vao=2*(10**3) #Anode dc voltage in Volt
Iao=1.5 #Anode dc current in ampere
ne=0.20 #Electronic efficiency
Pgen=Vao*Iao*ne
print"The induced RF power(in W)is =",int(Pgen),"W"
#(b) Calculate the total RF output power
Pin=80 #RF input power in Watt
Pout=Pin+(Pgen)
print"The total RF output power(in W)is =",int(Pout),"W"
#(c) Calculate the power gain
g=Pout/Pin
g=10*log10(g) #in decibels
print"The power gain(in dB)is =",round(g,1),"dB"
import math
#(a) Calculate the dc electron-beam velocity
V0=15*(10**3) #Anode voltage in Volt
v0=0.593*(10**6)*sqrt(V0) #v0=sqrt((2*e*V0)/m),where e is the charge on electron and m is the mass of electron
#sqrt(2*e/m)=0.593*(10**6)
print"The dc electron-beam velocity (in m/s)is =","{:.3e}".format(v0),"m/s" #answer in book is wrong
#(b) Calculate the electron-beam phase constant
f=8*(10**9) #operating frequency in Hertz
w=2*math.pi*f #angular frequency in Hertz
v0=int(v0/100000) #converting v0 in to the format printed above for easy calculations
v0=v0*100000
Be=w/v0
print"The electron-beam phase constant(in rad/m)is =",round(Be,2),"rad/s"
#(c) Calculate the cyclotron angular frequency
em=1.759*(10**11) #em=e/m is the charge to mass ratio of electron
Bo=0.2 #Magnetic flux density in Wb/m**2
wc=(em*Bo)
print"The cyclotron angular frequency(in rad/s)is =","{:.3e}".format(wc),"rad/s"
#(d) Calculate the cyclotron phase constant
Bm=wc/v0
print"The cyclotron phase constant(in rad/m)is =",round(Bm,2),"rad/s"
#(e) Calculate the gain parameter
Z0=50 #characteristic impedance in Ohms
I0=3.0 #Anode current in ampere
C=((I0*Z0)/(4*V0))**(1/3.0)
print"The gain parameter is =",round(C,3)
import math
#(a)Calculate the dc electron velocity
V0=20*(10**3) #Anode voltage in Volt
v0=0.593*(10**6)*sqrt(V0) #v0=sqrt((2*e*V0)/m),where e is the charge on electron and m is the mass of electron
#sqrt(2*e/m)=0.593*(10**6)
print"The dc electron velocity (in m/s)is =","{:.3e}".format(v0),"m/s"
#(b) Calculate the electron-beam phase constant
f=4*(10**9) #operating frequency in Hertz
w=2*math.pi*f #angular frequency in Hertz
Be=w/v0
print"The electron-beam phase constant(in rad/m)is =",int(round(Be)),"rad/m"
#(c) Calculate the delta differentials
b=0.5 #b factor
print"The Delta differentials are:"
s1=(1j)*((b-sqrt((b**2)+4))/2)
s1=round(s1.imag,2)
s1=0+1j*s1
print"s1=",s1
s2=(1j)*((b+sqrt((b**2)+4))/2)
s2=round(s2.imag,2)
s2=0+1j*s2
print"s2=",s2
#(d)Calculate the propagation constants
D=0.8 #D factor
print"The propagation constants are:"
r1=((1j)*(round(Be)+b))+(b*D*s1)
r1=round(r1.imag,1)
r1=0+1j*r1
print"r1=",r1
r2=((1j)*(round(Be)+b))+(b*D*s2) # in book the value of s2 is used with negative sign which is wrong
r2=round(r2.imag,2)
r2=0+1j*r2
print"r2=",r2
#(e)Calculate the oscillation condition
print"The oscillation occurs at DN=1.25 for n=1"
N=1.25/D
print"then N=",N
l=(2*math.pi*N)/round(Be)
l=l*100 #in cm
print"and l= 2*pi*N/Be(in cm) =",round(l,2),"cm"