#Calculate dc electron velocity,dc Phase Constant,Plasma Frequency,Reduced Plasma Frequency,dc beam current density,instantaneous beam current density
import math
#Variable declaration
Vo = 14.5*10**3 #beam voltage(V)
i = 1.4 #beam current(A)
f = 10*10**9 #frequency(Hz)
rho_o = 10**-6 #dc electron charge density(c/m^3)
rho = 10**-8 #RF charge density(c/m^3)
V = 10**5 #velocity perturbations(m/s)
eo = 8.854*10**-12
R = 0.4
#Calculations
#Part a
vo = 0.593*10**6*math.sqrt(Vo) #dc electron velocity
#Part b
w = 2.*math.pi*f
ip = w/vo #dc phase current
#Part c
wp = math.sqrt((1.759*10**11*rho_o)/eo)
#Part d
wq = R*wp
#Part e
Jo = rho_o * vo
#Part f
J = rho*vo+rho_o*V
#Results
print "dc electron velocity =",round((vo/1E+8),3),"*10**8 m/sec"
print "dc phase curent =",round(ip,2),"rad/sec (Calculation mistake in the textbook)"
print "plasma frequency =",round((wp/1E+8),2),"*10**8 rad/sec"
print "Reduced plasma frequency =",round((wq/1E+8),3),"*10**8 rad/sec"
print "dc beam current density =",round(Jo,1), "A/m^2"
print "instantaeneous beam current density =",round(J,3),"A/m^2"
#Calculate input rms voltage,output rms voltage,output power
import math
#Variable declaration
Av = 15. #voltage gain(dB)
Pin = 5*10**-3 #input power(W)
Rsh_in = 30*10**3 #Rsh of input cavity(Ohms)
Rsh_out = 20.*10**3 #Rsh of output cavity(Ohms)
Rl = 40*10**4 #load impedance(Ohms)
#Calculations
#Part a
V1 = math.sqrt(Pin*Rsh_in) #input rms voltage
#Part b
#Av = 20log(V2/V1) db
V2 = V1*10**(Av/20) #deriving V2 from above equation
#Part c
Pout = (V2**2)/Rsh_out #output power
#Results
print "input rms voltage =",round(V1,2),"V"
print "output rms voltage =",round(V2,2),"V"
print "output power =",round((Pout/1E-3),1),"mW"
#Calculate input power output power,efficiency
import math
#Variable declaration
n = 2 #no. of modes
Vo = 300 #beam voltage(V)
Io = 20*10**-3 #beam current(A)
J1X = 1.25
#Calculations
#Part a
Pdc = Vo*Io #input power
#Part b
Pac = (2*Pdc*J1X)/(2*math.pi*n-(math.pi/2))
#Part c
N = (Pac/Pdc)*100. #efficiency
#Results
print "Input power =",round(Pdc,2),"W"
print "Output power =",round(Pac,2),"W"
print "Efficiency =",round(N,1),"%"
#Calculate Electron velocity,dc transit time of electrons,Maximum input voltage,Volatge gain
import math
#Varaible declaration
Vo = 900 #beam voltage(V)
Io = 30*10**-3 #beam current(A)
f = 8*10**9 #frequency(Hz)
d = 1*10**-3 #gap spacing in either cavity(m)
L = 4*10**-2 #spacing between centers of cavities(m)
Rsh = 40*10**3 #effective shunt impedance(Ohms)
J1X = 0.582
X = 1.841
#Calculations
#Part a
vo = 0.593*10**6*math.sqrt(Vo)
#Part b
To = L/vo
#Part c
w = 2*math.pi*f
theta_o = w*To
theta_g = (w*d)/vo
Bo = math.sin(theta_g/2)/(theta_g/2)
V1_max = (Vo*3.68)/(Bo*theta_o)
#Part d
Ro = Vo/Io
Av = ((Bo**2)*theta_o*J1X*Rsh)/(Ro*X)
#Results
print "Electron velocity =",round((vo/1E+6),2),"*10**6 m/sec"
print "dc transit time of electrons =",round((To/1E-8),3),"*10**-8 sec"
print "Maximum input voltage =",round(V1_max,3),"V"
print "Volatge gain =",round(Av,3),"V"
#Calculate input microwave voltage V1 in order to generate maximum output voltage,
#Calculate voltage gain,efficiency of the amplifier neglecting beam loading, beam loading conductance
import math
#Variable declaration
Vo = 1200. #beam voltage(V)
Io = 28*10**-3 #beam current(A)
f = 8*10**9 #frequency(Hz)
d = 1*10**-3 #gap spacing in either cavity(m)
L = 4.*10**-2 #spacing between centers of cavities(m)
Rsh = 40*10**3 #effective shunt impedance(Ohms)
J1X = 0.582
X = 1.841
Go = 23.3*10**-6
#Calculations
#Part a
vo = 0.593*10**6*math.sqrt(Vo)
w = 2*math.pi*f
theta_o = (w*L)/vo
theta_g = (w*d)/vo
Bo = math.sin(theta_g/2)/(theta_g/2)
V1_max = (Vo*3.68)/(Bo*theta_o)
#Part b
Ro = Vo/Io
Av = ((Bo**2)*theta_o*J1X*Rsh)/(Ro*X)
#Part c
V2 = 2*Io*J1X*Bo*Rsh
N = ((0.58*V2)/Vo)*100
#Part d
Gb = (Go*((Bo**2)-(Bo*math.cos(theta_g))))/2
Rb = 1/Gb
#Results
print "The input microwave voltage V1 in order to generate maximum output voltage is",round(V1_max,2),"V"
print "The voltage gain (reflecting beam loading in the output cavity) is",round(Av,3)
print "The efficiency of the amplifier neglecting beam loading is",round(N,2),"%"
print "The beam loading conductance is",round((Rb/1E+3)),"K Ohms"
print "The value of",round((Rb/1E+3)),"K Ohms is very much comparable to Rsh and cannot be neglected because theta_g is quite high"
#Calculate value of repeller voltage,dc necesaary to give the microwave gap of voltage of 200V,elctron efficiency
import math
#Variable declaration
Vo = 500. #beam voltage(V)
Rsh = 20*10**3 #effective shunt impedance(Ohms)
f = 8*10**9 #frequency(Hz)
L = 1.*10**-3 #spacing between centers of cavities(m)
n = 2
e_m = 1.759*10**11
V1 = 200
J1X = 0.582
#Calculations
#Part a
w = 2*math.pi*f
x = (e_m*((2*math.pi*n)-(math.pi/2))**2)/(8*(w**2)*(L**2))
y = math.sqrt(Vo/x)
Vr = y+Vo
#Part b
Bo = 1 #Assumption
Io = V1/(2*J1X*Rsh)
#Part c
vo = 0.593*10**6*math.sqrt(Vo)
theta_o = (w*2*L*vo)/(e_m*(Vr+Vo))
Bi = 1 #Assumption
X_dash = (V1*theta_o)/(2*Vo)
X = 1.51 #from graph
J1X = 0.84
N = ((2*J1X)/((2*math.pi*n)-(math.pi/2)))*100
#Results
print "The value of repeller voltage is",round(Vr,2),"V (Calculation mistake in the textbook)"
print "The dc necesaary to give the microwave gap of voltage of 200V is",round((Io/1E-3),2),"mA"
print "The elctron efficiency is", round(N,2),"%"
#Calculate efficiency of the reflex klystron,total power output,elctron efficiency
import math
#Variable declaration
n = 1 #no. of modes
Pdc = 40*10**-3 #input power(W)
V1_Vo = 0.278 #ratio
#Calculations
#Part a
N = (V1_Vo*3*math.pi)/4
#Part b
Pout = (8.91*Pdc)/100
#Part c
Pl = (Pout*80)/100
#Results
print "The efficiency of the reflex klystron is",round(N,3)
print "The total power output is",round((Pout/1E-3),3),"W"
print "The power delivered to the load is",round((Pl/1E-3),2),"W"
#calculate Hull cut-off voltage,Cut-off magnetic flux density,Cyclotron frequency
#chapter-8 page 342 example 8.8
#For a circular magnetron
import math
a=0.15##inner radius in m
b=0.45##outer radius in m
B=1.2*10**(-3)##magnetic flux density in Wb/sqm
x=1.759*10**11##Value of e/m in C/kg
V=6000.##beam voltage in V
#CALCULATION
V0=((x/8.)*(B**2.)*(b**2.)*(1.-(a/b)**2.)**2.)/1000.##Hull cut-off voltage in kV
Bc=((math.sqrt(8.*(V/x)))/(b*(1.-(a/b)**2.)))*1000.##Cut-off magnetic flux density in mWb/sqm
fc=((x*B)/(2.*(math.pi)))/10.**9.##Cyclotron frequency in GHz
#OUTPUT
print '%s %2.3f %s %s %3.3f %s %s %.4f %s' %('\nHull cut-off voltage is V0=',V0,'kV','\nCut-off magnetic flux density is Bc=',Bc,'mWb/sqm','\nCyclotron frequency is fc=',fc,'GHz')#
#Check the answers once
#Correct answers are
#Hull cut-off voltage is V0=5.066 kV
#Cut-off magnetic flux density is Bc=1.305953 mWb/sqm
#Cyclotron frequency is fc=0.0336 GHz
#Calculate Axial phase velocity, anode voltage
import math
#Variable declaration
d = 2*10**-3 #diameter of helical TWT(m)
n = 50. #no. of turns per cm
v = 3*10**8 #velocity of light(m/s)
m = 9.1*10**-31 #mass of electron
e = 1.6*10**-19 #charge on electron
#Calculations
p = 1/n*10**-2 #pitch(m)
c = math.pi*d #circumference(m)
Vp = (v*p)/c
Vo = (m*(Vp**2))/(2*e)
#Results
print "Axial phase velociity =",round(Vp,2),"m/sec"
print "Anode voltage =",round(Vo,2),"V(Calculation mistake in the textbook)"
#Calculate dc electron velocity,Transit time,Input voltage,Voltage gain
import math
#Variable declaration
Vo = 900 #beam voltage(V)
Io = 30.*10**-3 #beam current(A)
f = 8.*10**9 #frequency(Hz)
d = 1.*10**-3 #gap spacing in either cavity(m)
L = 4.*10**-2 #spacing between centres of cavity(m)
Rsh = 40.*10**3 #effective shunt impedance(Ohms)
#Calculations
#Part a
vo = 0.593*10**6*math.sqrt(Vo)
#Part b
Tt = d/vo
#Part c
w = 2*math.pi*f
theta_g = (w*d)/vo
Bo = math.sin(theta_g/2)/(theta_g/2) #Beam coupling coefficient
theta_o = (w*L)/vo #dc transit angle
#For maximum o/p volltage,
J1X = 0.582
X = 1.841
V1max = (2*Vo*X)/(Bo*theta_o)
#Part d
Av = (Bo**2*theta_o*J1X*Rsh)/(Io*X)
#Results
print "dc electron velocity =",round((vo/1E+7),1),"*10**7 m/sec"
print "Transit time =",round((Tt/1E-10),2),"*10^-10 s"
print "Input voltage for maximum output voltage =",round(V1max,2),"V"
print "Voltage gain =",round((Av/1E+6),2),"dB"
#Calculate dc electron velocity,dc phase constant,plasma frequency ,Reduced plasma frequency ,dc beam current density,instantaeneous beam current density
import math
#Variable declaration
Vo = 20*10**3 #beam voltage(V)
Io = 2 #beam current(A)
f = 9*10**9 #frequency(Hz)
rho_o = 10**-6 #dc electron charge density(c/m^3)
rho = 10**-8 #RF charge density(c/m^3)
V = 10**5 #velocity perturbations(m/s)
eo = 8.854*10**-12
R = 0.5
#Calculations
#Part a
vo = 0.59*10**6*math.sqrt(Vo)
#Part b
w = 2.*math.pi*f
ip = w/vo #dc phase current
#Part c
wp = math.sqrt((1.759*10**11*rho_o)/eo)
#Part d
wq = R*wp
#Part e
Jo = rho_o * vo
#Part f
J = rho*vo-rho_o*V
#Results
print "dc electron velocity =",round((vo/1E+7),3),"*10**7 m/sec"
print "dc phase constant =",round(ip,2),"rad/sec (Calculation mistake in the textbook)"
print "plasma frequency =",round((wp/1E+8),2),"*10**8 rad/sec"
print "Reduced plasma frequency =",round((wq/1E+8),3),"*10**8 rad/sec"
print "dc beam current density =",round(Jo,2), "A/m^2"
print "instantaeneous beam current density =",round(J,4),"A/m^2"
#Calculate Transit angle
import math
#Variable declaration
f = 5*10**9 #frequency(Hz)
Vo = 1000 #operating voltage(V)
n = 1.75 #no. of turns
Vr = -500 #repeller voltage(V)
d = 2*10**-3 #cavity gap(m)
#Calculations
w = 2*math.pi*f
uo = 5.93*10**5*math.sqrt(Vo)
theta_g = (w*d)/uo
#Results
print "Transit angle =",round(theta_g,3),"radians"
print "\nThe length of drift region cannot be computed as the value of F is not given"
#Calculate Input RF voltage ,Voltage gain ,efficiency
#Variable declaration
import math
f = 10*10**9 #frequency(Hz)
Vo = 1200 #beam voltage(V)
Io = 30*10**-3 #beam current(A)
d = 1*10**-3 #diameter(m)
Rsh = 40*10**3 #shunt resistance(Ohms)
L = 4*10**-2 #length(m)
X = 1.84
#Calculations
#Part a
vo = 0.59*10**6*math.sqrt(Vo)
w = 2*math.pi*f
theta_o = (w*L)/vo
V1 = (2*X*Vo)/theta_o
theta_g = (theta_o*d)/L
Bi = (math.sin(theta_g/2))/(theta_g/2)
V1max = V1/Bi
#Part b
J1X = 0.58 #from table
I2 = 2*Io*J1X
V2 = Bi*I2*Rsh
A = V2/V1
Av = 20*math.log10(A)
#Part c
N = ((0.58*V2)/Vo)*100
#Results
print "Input RF voltage is",round(V1max,3),"V"
print "Voltage gain is",round(Av,2),"dB"
print "efficiency is",round(N,2),"%"
#Calculate Cyclotron angular frequency,Hull cut-off voltage,Cut-off magnetic flux density
import math
#Variable declaration
Vo = 30*10**3 #beam voltage(V)
Io = 80 #beam current(A)
Bo = 0.01 #Wb/m**2
a = 4*10**-2 #length of magnetron(m)
b = 8*10**-2 #breadth of magnetron(m)
e = 1.6*10**-19 #charge on electron(C)
m = 9.1*10**-31 #mass of electron
#Calculations
#Part a
w = (e*Bo)/m
#Part b
Vhc = (e*(Bo**2)*(b**2)*((1-((a/b)**2))**2))/(8*m)
#PArt c
Bc = ((8*Vo*(m/e))**0.5)/(b*(1-((a/b)**2)))
#Results
print "Cyclotron angular frequency =",round((w/1E+9),3),"*10**9 rad/s"
print "Hull cut-off voltage =",round((Vhc/1E+3),4),"kV"
print "Cut-off magnetic flux density =",round((Bc/1E-3),3),"mWb/m**2"
#Calculate Input power,Output power,Efficiency
import math
#Variable declaration
n = 2 #mode
Vo = 280 #beam volatge(V)
Io = 22*10**-3 #beam current(A)
V1 = 30 #signal voltage(V)
#Calculations
#Part a
Pdc = Vo*Io
#Part b
J1X = 1.25 #from table
Pac = (2*Pdc*J1X)/((2*n*math.pi)-(math.pi/2))
#Part c
N = (Pac/Pdc)*100
#Results
print "Input power =",round(Pdc,2),"W"
print "Output power =",round(Pac,2),"W"
print "Efficiency =",round(N,2),"%"
#Calculate
import math
#Variable declaration
f = 8*10**9 #frequency(Hz)
Vo = 300 #beam voltage(V)
Rsh = 20*10**3 #shunt resistance(Ohms)
L = 1*10**-3 #length(m)
V1 = 200 #gap voltage(V)
e_m = 1.759*10**11
n = 2 #mode
#Calculations
#Part a
w = 2*math.pi*f
x = (e_m*((2*math.pi*n)-(math.pi/2))**2)/(8*(w**2)*(L**2))
y = math.sqrt(Vo/x)
Vr = y+Vo
#Part b
Bo = 1 #assumption
J1X = 0.582 #from table
Io = V1/(2*J1X*Rsh)
#Results
print "Repeller voltage =",round(Vr,3),"V"
print "Beam current =",round((Io/1E-3),2),"mA"