# Crowbar circuit(refering to fig8.2)
import math
#Variable declaration
Vz = 14.8 # zener breakdown voltage
Vt = 0.85 # thyristor trigger voltage
# Calculations
Vi = Vz+Vt
#Result
print("Thyrister will be turned on when voltage across R is %.2f V."%Vt)
print("Since zener breakdown at %.1f V, the crowbar circuit will be turned on when\nVi = %.2f V"%(Vz,Vi))
# Crowbar circuit(refering to fig.8.2)
import math
Rz = 15.0 # resistance of zener diode under breakdown condition
Ig = 20*10**-3 # gate triggering current of thyristor
Vz = 14.8 # zener breakdown voltage
Vt = 0.85 # thyristor trigger voltage
R = 50.0 # resistance
#Calculations
Rt = (R*Rz)/(R+Rz)
V = Rt*Ig
Vi = Vz+Vt+V
#Result
print("Vi = %.3f V"%Vi)
# Values of R and C (refering to fig.8.3)
import math
#Variable declaration
V = 200 # input voltage
Il = 10 # load current
Toff1 = 15*10**-6 # turn off time
Ih = 4*10**-3 # thyristor holding current
#Calculations
R = V/Ih
Rl = V/Il
C = Toff1/(Rl*math.log(2))
#Result
print("R = %.0f k-ohm\nC = %.3f*10^-6 F"%(R/1000,C*10**6))
# duty cycle and Ton/Toff ratio
import math
# Variable declaration
V = 230.0 # input voltage
R = 60.0 # load resistance
P1 = 400.0 # output ppower in case 1
P2 = 700.0 # output ppower in case 2
#Calculations
Pmax = (V**2)/R
#(a)
alfa = P1/Pmax
Ton = alfa
Toff= 1-Ton
r = Ton/Toff
#(b)
alfa2 = P2/Pmax
Ton2 = alfa2
Toff2= 1-Ton2
r2= Ton2/Toff2
#Result
print("Maximum power output = %.2f W\n\n(a)\n Duty cycle = %.4f\n Ton/Toff = %.4f"%(Pmax,alfa,math.ceil(r*10000)/10000))
print("\n(b)\n Duty cycle = %.3f\n Ton/Toff = %.3f"%(alfa2,math.ceil(r2*1000)/1000))
# Output RMS voltage
import math
# Variable declaration
Ton = 12.0 # circuit is on for 12 cycles
Toff = 19.0 # circuit is on for 19 cycles
V = 230.0 # input voltage
#calcualtions
d = Ton/(Ton+Toff)
Vrms = V*math.sqrt(d)
#Result
print("RMS output voltage = %.1f V"%Vrms)
# Power supplied to heater
import math
#Variable declaration
V = 230 # input voltage
R = 50 # load resistance
alfa1 = 90 # firing angle for case 1
alfa2 = 120 # firing angle for case 2
#Calculations
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = V*sqrt_2
#(a)
Vl = Vm*math.sqrt((math.pi-(alfa1*math.pi/180)+((math.sin(2*alfa1*math.pi/180))/2.0))/(2*math.pi))
P = (Vl**2)/R
#(b)
Vl2 = Vm*math.sqrt((math.pi-(alfa2*math.pi/180)+((math.sin(2*alfa2*math.pi/180))/2.0))/(2*math.pi))
P2 = (Vl**2)/R
#Result
print("(a) when alfa = %.0f°,\n Power = %.2fW"%(alfa1,Vl))
print("\n(b) when alfa = %.0f°,\n Power = %.2fW"%(alfa2,Vl2))
# finding firing angle
import math
from numpy import poly1d
#variable declaration
V = 230.0 # input voltage
R = 10 # load resistance
P1 = 2645 # power supplied to heater in case a
P2 = 1587 # power supplied to heater in case b
#Calculations
Pmax = (V**2)/R
#(a)
Vl1 = math.floor((math.sqrt(P1*R))*100)/100
#After solving equation using taylor seris of X, we got following coefficient.
P1 = poly1d([128.0/math.factorial(7),0,-32.0/math.factorial(5),0,8.0/math.factorial(3),0,0,(-2*math.pi*(1-(Vl1/V)**2))], variable = 'x')
x1 = P1.r[(P1.order+1)/2]*180/math.pi
alfa1 = x1.real
#(b)
Vl2 = math.floor((math.sqrt(P2*R))*1000)/1000
P2 = poly1d([128.0/math.factorial(7),0,-32.0/math.factorial(5),0,8.0/math.factorial(3),0,0,(-2*math.pi*0.762500)], variable = 'x')
# hardcoded value used to match the answer to the book
x2 = P2.r[(P2.order+1)/2]*180/math.pi
alfa2 = x2.real
#Result
print("(a) firing angle = %.0f°"%math.ceil(alfa1))
print("(b) firing angle = %.1f°"%(alfa2)
# current rating and Peak Inverse Voltage of each thyristor
import math
#Variable declaration
V = 400 # 3-phase input voltage
P = 20*10**3 # load
#Calculations
#(a)
# since load is resistive, theta = 0°,therefore, cos(theta) = 1
I = P/(math.sqrt(3)*V)
PIV = V*math.sqrt(2)
PIV = math.floor(PIV*10)/10
#(b)
Ir = I/math.sqrt(2)
Ir = math.ceil(Ir*100)/100
#Result
print("(a)\n I = %.2f A\n During off state, line to line voltage can appear across triac. Hence current rating is %.2f A and"%(I,I))
print(" peak inverse voltage = %.1f V"%PIV)
print("\n(b)\n Each thyristor conducts for every half cycle.\n current rating = %.2f A\n Peak inverse voltage is the same i.e. %.1f V"%(Ir,PIV))
# applied voltage and current
import math
#variable declaration
t = 5*10**-2 # insulating slab thickness
A = 100*10**-4 # insulating slab area
P = 300 # power
f = 10*10**6 # frequency
eps = 8.85*10**-12 # permitivity of free space
eps_r = 4.5 # relative permitivity
pf = 0.05 # power factor
#Calculation
C = eps*eps_r*A/t
pi =math.floor(math.pi*100)/100
w = 2*pi*f
fi = (math.acos(pf))*(180/math.pi)
sig =90-fi
sig = math.ceil(sig*1000)/1000
sig = sig*math.pi/180
V = math.sqrt(P/(w*C*math.tan(sig)))
I = P/(V*pf)
#Result
print("V = %.1f V\nI = %.2f A"%(V,I))
# power input and current
import math
# Variable declaration
t = 1*10**-2 # insulating slab thickness
A = 50*10**-4 # insulating slab area
V = 400 # input voltage
f = 20*10**6 # frequency
eps = 8.85*10**-12 # permitivity of free space
eps_r = 5 # relative permitivity
pf = 0.05 # power factor
#Calculation
C = eps*eps_r*A/t
w = 2*math.pi*f
fi = (math.acos(pf))*(180/math.pi)
sig =90-fi
sig = math.ceil(sig*1000)/1000
sig = sig*math.pi/180
P = (V**2)*(w*C*math.tan(sig))
I = P/(V*pf)
#Result
print("P = %.2f W\nI = %.4f A"%(P,I))
# voltage of the source and current input
import math
#variable declaration
t = 2 # insulating slab thickness
A = 75 # insulating slab area
T1 = 20 # lower temperature
T2 = 50 # Higher temperature
Time = 7*60 # time
f = 20*10**6 # frequency
eps = 8.85*10**-12 # permitivity of free space
eps_r =6.5 # relative permitivity
sh = 0.25 # specific heat
den = 0.55 # density
pf = 0.04 # power factor
#Calculations
C = eps*eps_r*A*10**-4/(t*10**-2)
w = 2*math.pi*f
fi = (math.acos(pf))*(180/math.pi)
sig =90-fi
sig = math.ceil(sig*1000)/1000
sig = sig*math.pi/180
m = A*t*den
H = m*sh*(T2-T1)
TH = H/0.9
Ei = TH*4.186
P = Ei/Time
P = math.floor(P*100)/100
V = math.sqrt(P/(w*C*pf))
V = math.ceil(V*100)/100
I = P/(V*pf)
I = math.floor(I*1000)/1000
#Result
print("V = %.2f V\nI = %.3f A"%(V,I))