# Chapter 2: Thyristors¶

## example 2.1, Page No.39¶

In :
# Anode current

import math
#Variable declaration
alfa_1 = 0.35         # Gain of PNP transistor of two transistor model
alfa_2 = 0.40         # Gain of NPN transistor of two transistor model
Ig = 40*10**-3        # Gate current

#Calculations
Ia = (alfa_2*Ig)/(1-(alfa_1+alfa_2))

#Result
print("Anode current = %d * 10^-3 A"%(Ia*1000))

Anode current = 64 * 10^-3 A


## example 2.2, Page No.41¶

In :
# Equivalent capacitor

import math
# Variable declaration
dv_by_dt = 190                # in Volt per micro-sec
Ic= 8 *10**-3                 # Capacitive current

#Calculation
C = Ic/(dv_by_dt*10**6)

#Result
print("C = %.1f * 10^12 F"%(C*10**12))

C = 42.1 * 10^12 F


## example 2.3, Page No. 42¶

In :
# Thyristor

import math
# Variable declaration
Vt = 0.75               # Thyristor trigger voltage
It = 7*10**-3           # Thyristor trigger current
Vcc = 20                # Suppy voltage, given data
Rg = 2000               # gate resistor, given data
R = 200                 # input resistor

#Calculations
#(a)
V0 = 20                 # when thyristor is not conducting, there is no current through it.
#(b)
Vs = Vt+It*Rg
#(c)
i= 5*10**-3              #to have holding curernt
v1= i*R
#(d)
drop =0.7                # voltage drop across thyristor
v2=v1+drop

#Result
print("(a) V0 = %d\n(b) Vs = %.2f\n(c) Vcc should be reduced to less than %d V if thyristor is ideal.\n(d) Vcc should be reduced to less than %.1f V"%(V0,Vs,v1,v2))

(a) V0 = 20
(b) Vs = 14.75
(c) Vcc should be reduced to less than 1 V if thyristor is ideal.
(d) Vcc should be reduced to less than 1.7 V


## example 2.4, Page No.42¶

In :
# calculation of Vg,Ig and Rg

import math
#variable declaration
Vs = 25                      # gate signal amplitude
Pavg_loss = 0.6              # Avg power loss

#Calculations
P_loss = Pavg_loss*2*math.pi/math.pi
Ig =(-1+(math.sqrt(1**2-4*9*(-1.2))))/(2*9) #alfa=(-b+sqrt(b^2-4ac))/2a-->solution for quadratic equation
Ig = math.ceil(Ig*1000)/1000
Vg = 1+9*Ig                                 #given data
Rg = (24-9*Ig)/Ig

#Calculations
print("Vg = %.3f \nIg = %.3f\nRg = %.2f"%(Vg,Ig,Rg))

Vg = 3.826
Ig = 0.314
Rg = 67.43


## example 2.5, Page No.42¶

In :
# Minimum width of gate pulse

import math
#Variable declaration
V = 100                   # DC supply voltage
L = 10                    # Inductance
i = 80*10**-3             # latching current of thyristor

#Calculations
t = L*i/V

#Result
print("Width of pulse should be more than %d milli-second."%(t*10**3))

Width of pulse should be more than 8 milli-second.


## example 2.6, Page No. 43¶

In :
# Minimum width of gate pulse

import math
#Variable declaration
V = 100                   # DC supply voltage
R = 10                    # Resistance
L = 5                     # Inductance
i = 50*10**-3             # latching current of thyristor

#Calculation
t = math.log((1-(i*R)/V))/((-R/L)*math.log(math.e))        # i = (V/R)*(1-e^(-R*t/L))

#Result
print("Minimum width of gate pulse is %.1f milli-second."%(t*10**3))

Minimum width of gate pulse is 2.5 milli-second.


## example 2.7, Page No. 43¶

In :
# resistor value

import math
#Variable declaration
V = 90.0                # DC supply voltage
i = 40*10**-3           # latching current of thyristor
t = 40* 10**-6          # pulse width
R = 25.0                # load Resistance
L = 0.5                 # Inductance
#Calculation
#(a)
i2 = (V/R)*(1-math.e**(-R*t/L))

#(b)
R = V/(i-i2)

#Result
print("(a)\nAt the end of the gate pulse, i = %.4f A"%i2)
print("Since the current is less than latching current, thyristor will not turn on.")
print("\n(b)\nR should be less than %d ohm."%math.ceil(R))

(a)
At the end of the gate pulse, i = 0.0072 A
Since the current is less than latching current, thyristor will not turn on.

(b)
R should be less than 2744 ohm.


## example 2.8, Page No.44¶

In :
# Resistor value

import math
#Variable declaration
V = 100.0                # DC supply voltage
i = 50*10**-3            # holding current of thyristor
t = 50* 10**-6           # pulse width
R = 20.0                 # load Resistance
L = 0.5                  # Inductance

#Calculations
i2 = (V/R)*(1-math.e**(-R*t/L))
Rmax = V/(i-i2)

#Result
print("When firing pulse ends, i = %.2f mA"%(i2*10**3))
print("Since this current is less than holding current, the thyristor will not remain on and return to off state.")
print("Maximum value of R = %.3f ohm"%(math.floor(Rmax*1000)/1000))

When firing pulse ends, i = 9.99 mA
Since this current is less than holding current, the thyristor will not remain on and return to off state.
Maximum value of R = 2499.375 ohm


## example 2.9, Page No.44¶

In :
# triggering angle

import math
#Variable declaration
V = 240                  # AC supply voltage
f = 50                   # supply frequency
R = 5                    # load resistance
L = 0.05                 # inductance

#Calculation
theta = math.atan(2*math.pi*f*L/R)
theta = theta*180/math.pi
fi = theta+90
print("theta = %.2f°"%(theta))
print("\nCurrent transient is maximun(worst) if\nsin(fi-theta) = 1")
print("therefore, fi-%.2f° = 90°"%theta)
print("fi = %.2f°"%fi)

theta = 72.34°)

Current transient is maximun(worst) if
sin(fi-theta) = 1
therefore, fi-72.34° = 90°
fi = 162.34°


## example 2.10, Page No.47¶

In :
print("Theoretical example ")

Theoretical example


## example 2.11, Page No.50¶

In :
print("Theoretical example ")

Theoretical example


## example 2.12, Page No. 53¶

In :
# rms current and form factor

import math
# variable declaration
I = 120                 # Current in Ampere
gamma = 180.0           # in degrees, thyristor conducts between alfa and alfa+gamma in each 360°

# calculations
#(a)-- formulas
#(b)
Irms = I*math.sqrt(gamma/360)
Iavg = I*(gamma/360)
ff = Irms/Iavg

#result
print("RMS curent = %.2f A\nAverage Current = %.0f A\nForm factor = %.3f"%(Irms,Iavg,ff))

RMS curent = 84.85 A
Average Current = 60 A
Form factor = 1.414


## example 2.13, Page No.53¶

In :
# Power supplied to the load and average load current

import math
from scipy.integrate import quad
# variable declaration
R = 100.0                       # load resistance
V = 230.0                       # Supply Voltage

#Calculations
#(a)
def f(x):
return math.sin(x)**2
wt_lower=math.pi/3
wt_upper =math.pi
val = quad(f,wt_lower,wt_upper)
I = ((math.sqrt(2)*V/R)**2)*val/(2*math.pi)
Irms = math.sqrt(I)
P =(Irms**2)*R

#(b)
def f(x):
return math.sin(x)**2
wt_lower2=math.pi/4
wt_upper2 =math.pi
val2 = quad(f,wt_lower2,wt_upper2)
x = (math.sqrt(2)*V/R)
x = math.floor(x*100)/100
I2 = (x**2)*val2/(2*math.pi)
Irms2 = math.sqrt(I2)
P2 =(Irms2**2)*R

#(c)
def f(x):
return (3.25/(2*math.pi))*math.sin(x)
wt_lower3=math.pi/3
wt_upper3 =math.pi
val3 = quad(f,wt_lower3,wt_upper3)
wt_lower4=math.pi/4
wt_upper4 =math.pi
val4 = quad(f,wt_lower4,wt_upper4)

print("(a)\nRMS current = %.2f A\nPower supplied to load = %d W"%(Irms,math.ceil(P)))
print("\n\n(b)\nRMS current = %f A\nPower supplied to load = %f W"%(Irms2,P2))
print("\n(c)\nWhen firing angle is 60°, Average current = %.3f A" %val3)
print("When firing angle is 45°, Average current = %.3f A" %val4)
# for (b) answer matches to the book if val2 = 1.4255

(a)
RMS current = 1.46 A
Power supplied to load = 213 W

(b)
RMS current = 1.549431 A
Power supplied to load = 240.073727 W

(c)
When firing angle is 60°, Average current = 0.776 A
When firing angle is 45°, Average current = 0.883 A


## example 2.14, Page No.54¶

In :
# average power loss in thyristor

import math
# Variable declaration
Iavg = 200                  # Average current
v1 = 1.8                    # voltage drop across thyristor for 200A current
v2 = 1.9                    # voltage drop across thyristor for 400A current

#Calculations
#(a)
A1 = Iavg                   # amplitude of rectangular current wave
P1 = A1*v1
#(b)
A2 = 2*Iavg
P2 = A2*v2*math.pi/(2*math.pi)

#Result
print("(a) Average power loss = %d W"%P1)
print("(b) Average power loss = %d W"%P2)

(a) Average power loss = 360 W
(b) Average power loss = 380 W


## example 2.15, Page No.55¶

In :
# average on state current

import math
#Variable declaration
I = 40                # rms on state current
f = 50                # frequency
cp_a =170             # conduction period
cp_b =100             # conduction period
cp_c =40              # conduction period

#Calculations
alfa_a = 180-cp_a
alfa_b = 180-cp_b
alfa_c = 180-cp_c
Im_a = math.sqrt(((I**2)*2*math.pi)/(((math.pi-alfa_a*math.pi/180)/2)+math.sin(2*alfa_a*math.pi/180)/4))
Iv_a = 0.316*Im_a
Im_b = math.sqrt(((I**2)*2*math.pi)/(((math.pi-alfa_b*math.pi/180)/2)+math.sin(2*alfa_b*math.pi/180)/4))
Iv_b = 0.1868*Im_b
Im_c = math.sqrt(((I**2)*2*math.pi)/(((math.pi-alfa_c*math.pi/180)/2)+math.sin(2*alfa_c*math.pi/180)/4))
Iv_c = 0.0372*Im_c

#Result
print("(a) Iavg = %.3f A"%(math.ceil(Iv_a*1000)/1000))
print("(b) Iavg = %.2f A"%Iv_b)
print("(c) Iavg = %.2f A"%(math.floor(Iv_c*100)/100))
#answer for(b) is not matching with the answer given in the book.

(a) Iavg = 25.295 A
(b) Iavg = 19.13 A
(c) Iavg = 11.62 A


## example 2.16, page No. 56¶

In :
# power dissiopation

import math
from scipy.integrate import quad
#variable declaration
It = 20                     # constant current

#Calculations
#(a)
Vt = 0.9+ 0.02*It
P1 = Vt*It
#(b)
def f(x):
return (0.9+0.02*(20*math.pi*math.sin(x)))*(20*math.pi*math.sin(x))/(2*math.pi)
# if denominator math.pi value is taken as 3.14, then answer for P2 =37.75
theta_lower = 0
theta_upper = math.pi
val = quad(f,theta_lower,theta_upper)
P2 = val
#(c)
P3 = P1/2
#(d)
P4 = P1/3

#result
print("(a) Power dissipation = %d W"%P1)
print("(b) Mean Power dissipation = %.2f W"%P2)
print("(c) Mean Power dissipation = %d W"%P3)
print("(d) Mean Power dissipation = %.2f W"%P4)

(a) Power dissipation = 26 W
(b) Mean Power dissipation = 37.74 W
(c) Mean Power dissipation = 13 W
(d) Mean Power dissipation = 8.67 W


## example 2.17, Page No. 57¶

In :
# I^2t rating

import math
# Variable declaration
Is = 2000.0              # half cycle surge current rating for SCR
f = 50.0                 # operating AC frequency

#Calculation
T = 1/f
t_half = T/2
t = t_half/2
I = math.sqrt((Is**2)*t/t_half)
rating = (I**2)*t_half

#Result
print("I^2t rating = %d A^2 secs"%rating)

I^2t rating = 20000 A^2 secs


## example 2.18, Page No. 59¶

In :
# Resistance and average power loss

import math
#variable declaration
P = 6                #peak power loss
d = 0.3              # duty cylce

#calculations
#(a)
#solution of equation 9Ig^2+Ig-6 = 0
Ig =(-1+(math.sqrt(1**2-4*9*(-6))))/(2*9)    #alfa=(-b+sqrt(b^2-4ac))/2a-->solution for quadratic equation
Ig = math.ceil(Ig*1000)/1000
Rg = (11/Ig)-9                               #from KVL equation of gate circuit
#(b)
Pavg = P*d

#Result
print("(a)\nIg = %.3f A \nRg = %.3f ohm"%(Ig,Rg))
print("\n(b) Average power loss = %.1f W "%Pavg)

(a)
Ig = 0.763 A
Rg = 5.417 ohm

(b) Average power loss = 1.8 W


## example 2.19, Page No. 59¶

In :
# trigger current and voltage for gate power dissipation

import math
#variable declaration
Vs = 12                  # supply voltage
P = 0.3                  # Power dissipation
Rs  = 100                # load line slope i.e. source resistance

#Calculation
#solution for equation 100Ig^2-12Ig+0.3 = 0
Ig =(-(-Vs)-(math.sqrt((-Vs)**2-4*Rs*(P))))/(2*Rs)    #alfa=(-b(+/-)sqrt(b^2-4ac))/2a-->solution for quadratic equation
Vg = P/Ig
print("Ig = %.1f mA\nVg = %.2f V"%(Ig*1000,Vg))

Ig = 35.5 mA
Vg = 8.45 V


## example 2.20, Page No. 59¶

In :
# Finding values of resistors

import math
#Variable declaration
Es = 12.0             # Supply voltage
V = 800.0             # SCR voltage rating
I = 110.0             # SCR currert rating
imax = 250*10**-3     # Maximum permissible current through battery
isc = 600*10**-3      # short circuit current of the battery
Vg = 2.4              # required gate voltage
Ig = 50*10**-3        # required gate current
Vgmax = 3             # maximum gate voltage
Igmax = 100*10**-3    # maximum gate current

#Calculations
Rs = Es/isc
#considering R2 is not connected
R1 =(Es/imax)-Rs
#R1 must be 28 or more so that battery curenrt doesnot exceeds 250mA
R1min = Es/Igmax-Rs
R1max = ((Es-Vg)/Ig)-Rs
R1 = 125  #selected
R2 = Vgmax*(Rs+R1)/(Es-Vgmax)

# Result
print("Rs = %d ohm \n\nR1 must be more than %.0f ohm and must be less than %.0f ohm.\nTherefore, select R1 = %.0f "%(Rs,R1min,R1max,R1))
print("\nR2 should be less than %.3f ohm.\nTherefore, select R2 = %.0f ohm"%(R2,math.floor(R2)))

Rs = 20 ohm

R1 must be more than 100 ohm and must be less than 172 ohm.
Therefore, select R1 = 125

R2 should be less than 48.333 ohm.
Therefore, select R2 = 48 ohm


## example 2.21, Page No. 68¶

In :
# Surface temperature

import math
#Variable declaration
l = 0.2                 # length of aluminium rod
w = 0.01                # width of aluminium rod
d = 0.01                # depth of aluminium rod
tc = 220                # thermal conductivity
T1 = 30                 # temperature at far end
P = 3                   # injected heat

#Calculation
theta = l/(tc*w*d)
T2 = P*theta+T1

#Result
print("Temperature of the surface where heat is injected is %.2f°C"%T2)

Temperature of the surface where heat is injected is 57.27°C


## example 2.22, Page No. 68¶

In :
#Power losses

import math
#variable declaration
l = 2*10**-3            # lengthh of aluminium plate
a = 12*10**-4           # cross-section area
tc = 220                # thermal conductivity
td = 4                  # desired thermal drop along length

#Calculations
theta = l/(a*tc)
theta = math.floor(theta*10**6)/10**6
P_loss = td/theta

#Result
print("power losses = %.2f W"%P_loss)

power losses = 528.05 W


## example 2.23, Page No. 68¶

In :
#thermal resistance of heat sink

import math
#Variable declaration
P = 30.0              # power dissipation
T1 =125.0             # max junction temperature
T2 = 50.0             # max ambient temperature
tr1 =1.0              # thermal resistance of thyristor
tr2 = 0.3             # therrmal resistance of insuulator

#calculations
Tr = (T1-T2)/P
Tr_hs = Tr-tr1-tr2

#Result
print("Thermal resistance of heat sink = %.1f°C/W"%Tr_hs)

Thermal resistance of heat sink = 1.2°C/W


## example 2.24, Page No.68¶

In :
# Junction temperature

import math
#variable declaration
tr = 0.627              # thermal resistance of device
T = 93                  # heat sink temperature
V = 3                   # voltage at junction
I = 25                  # current at junction

#calculation
T_junction = tr*V*I+T

#Result
print("Junction Temperature = %d°C"%T_junction)

Junction Temperature = 140°C


## example 2.25, Page No. 68¶

In :
#Thermal resistance

import math
#Variable declaration
P = 40.0                #steady power loss in an SCR
Tr_hs = 0.8             # heat sink resistance
T1 = 120.0              # Maximumm junction temperature
T2 = 35.0               # ambient temperature

#calculation
Tr = (T1-T2)/P
Rsh = Tr - Tr_hs

#Result
print("Resistance of heat sink = %.3f°C/W"%Rsh)

Resistance of heat sink = 1.325°C/W


## example 2.26, Page No. 69¶

In :
# power loss and % increase in rating

import math
# variable declaration
Tj = 125                # maximum junction temperature
Ts1 = 80                # max heat sink temperature
tr_jc = 0.7             # thermal resistance from junction to case
tr_cs = 0.4             # thermal resistance from case to sink
Ts2 = 50                # decreased heat sink temperature
#calculations
#(a)
Pav1 = (Tj-Ts1)/(tr_jc+tr_cs)
#(b)
Pav2 =(Tj-Ts2)/(tr_jc+tr_cs)
rating = 100*(math.sqrt(Pav2)-math.sqrt(Pav1))/math.sqrt(Pav1)
rating = math.floor(rating*100)/100
# result
print("(a)\nAverage power loss = %.2fW"%Pav1)
print("\n(b)\nAverage power loss = %.2fW\n%% increase in rating = %.2f%%"%(Pav2,rating))

(a)
Average power loss = 40.91W

(b)
Average power loss = 68.18W
% increase in rating = 29.09%


## example 2.27, Page No. 75¶

In :
#Minnimum and maximum firing angle of triac

import math
#Variable declaration
Vs = 230.0                 # Supply voltage
f = 50.0                   # supply frequency
Vc = 25.0                  # breakdown voltage
C = 0.6*10**-6             # capacitance
Rmin = 2000                # minimum resistance
Rmax = 20000                # maximum resistance

#Calculations
#(a)
pi = math.ceil(math.pi*10**4)/10**4
Xc = 1/(2*pi*f*C)
Xc = math.floor(Xc*100)/100
Z1_m = math.sqrt(Rmin**2+Xc**2)
Z1_angle=math.atan(Xc/Rmin)
I1_m = Vs/Z1_m
I1_m = math.ceil(I1_m*10**5)/10**5
I1_angle = Z1_angle
Vc_m = I1_m*Xc
Vc_m = math.ceil(Vc_m*100)/100
Vc_angle = I1_angle*(180/math.pi)-90
alfa1 = (180/math.pi)*math.asin(Vc/(math.sqrt(2)*Vc_m))+(-Vc_angle)

#(b)
Z2_m = math.sqrt(Rmax**2+Xc**2)
Z2_m = math.floor(Z2_m*10)/10
Z2_angle=math.atan(Xc/Rmax)
I2_m = Vs/Z2_m
I2_m = math.floor(I2_m*10**6)/10**6
I2_angle = Z2_angle
V2c_m = I2_m*Xc
V2c_m = math.ceil(V2c_m*100)/100
V2c_angle = I2_angle*(180/math.pi)-90
alfa2 = (180/math.pi)*math.asin(Vc/(math.sqrt(2)*V2c_m))+(-V2c_angle)

#Result
print("Xc = %.2f ohms"%Xc)
print("\n(a) When R = %d ohms\n Z(magnitude) = %.2f\t\tZ(angle) = %.2f°"%(Rmin,Z1_m,-Z1_angle*(180/math.pi)))
print(" I(magnitude) = %.5f\t\tI(angle) = %.2f°"%(I1_m,I1_angle*(180/math.pi)))
print("\nVoltage across capacitor,\nV(magnitude) = %.2f\t\tV(angle) = %.2f°"%(Vc_m,Vc_angle))
print("\nMinimum firing angle = %.2f°"%alfa1)

print("\n(b) When R = %d ohms\n Z(magnitude) = %.2f\t\tZ(angle) = %.2f°"%(Rmax,Z2_m,-Z2_angle*(180/math.pi)))
print(" I(magnitude) = %f\t\tI(angle) = %.2f°"%(I2_m,I2_angle*(180/math.pi)))
print("\nVoltage across capacitor,\nV(magnitude) = %.2f\t\tV(angle) = %.2f°"%(V2c_m,V2c_angle))
print("\nMaximum firing angle = %.2f°"%(math.ceil(alfa2*10)/10))

Xc = 5305.15 ohms

(a) When R = 2000 ohms
Z(magnitude) = 5669.62		Z(angle) = -69.34°
I(magnitude) = 0.04057		I(angle) = 69.34°

Voltage across capacitor,
V(magnitude) = 215.23		V(angle) = -20.66°

Minimum firing angle = 25.37°

(b) When R = 20000 ohms
Z(magnitude) = 20691.60		Z(angle) = -14.86°
I(magnitude) = 0.011115		I(angle) = 14.86°

Voltage across capacitor,
V(magnitude) = 58.97		V(angle) = -75.14°

Maximum firing angle = 92.60°


## example 2.28, Page no. 80¶

In :
# UJT relaxation circuit

import math
#Variable declaration
V = 32.0                 #voltage
h = 0.63                 # voltage gain
Ip = 10*10**-6           # current
Vv = 3.5                 # voltage drop
Iv = 10*10**-3           # current through the circuit
Vf = 0.5                 # forward voltage drop across p-n junction
f = 50.0                 # frequency of ascillation
t = 50.0*10**-6          # width of triggering pulse(given value is 50ms but used value is 50 micro-sec)
C = 0.4*10**-6           # Capacitance(assumed)

#Calculations
T = 1/f
Vp = V*h+Vf
Rmax = (V-Vp)/Ip         # R should be less than the given value
Rmin = (V-Vv)/Iv         # R should be more than the given value
R = T/(C*math.log(1/(1-h)))
R4 = t/C
R3 = 10**4/(h*V)

#Result
print("The value of R = %.2f*10^3 ohm is within the Rmax = %.3f*10^6 ohm and Rmin = %.2f*10^3 ohm"%(R*10**-3,Rmax*10**-6,Rmin*10**-3))
print("Hence the value is suitable.\n\nR4 = %d ohm \nR3 = %d ohm"%(R4,R3))

The value of R = 50.29*10^3 ohm is within the Rmax = 1.134*10^6 ohm and Rmin = 2.85*10^3 ohm
Hence the value is suitable.

R4 = 125 ohm
R3 = 496 ohm


## example 2.29, Page No. 81¶

In :
#values of various components of circuit(referring to fig.2.36(a))

import math
# variable declaration
f = 2.0*10**3               # ouutput frequency
Vdc = 10                    # input voltage
h = 0.6                     # voltage gain
I = 0.005                   # peak discharge current
v = 0.5                     # voltage drop across p-n junction(assumed)

#Calculation
Vp = (Vdc*h)+v
R = (Vdc-Vp)/I              # R should be less than this value
T = 1.0/f
C1 = 0.5*10**-6             # capacitance(assumed)
R1 = (T)/(C1*math.log(1/(1-h)))

C2 = 1.0*10**-6             # capacitance(assumed)
R2 = (T)/(C2*math.log(1/(1-h)))

#Result
print("for C = %.1f micro-F, R = %d Ohm. \nThis value of R is not suitable because R must be less than %d ohm."%(C1*10**6,R1,R))
print("\nfor C = %.1f micro-F, R = %.1f Ohm.\nThis value is suitable because R is less than %d ohm"%(C2*10**6,R2,R))

for C = 0.5 micro-F, R = 1091 Ohm.
This value of R is not suitable because R must be less than 700 ohm.

for C = 1.0 micro-F, R = 545.7 Ohm.
This value is suitable because R is less than 700 ohm


## example 2.30, Page No. 82¶

In :
# Range of firing angle

import math
#Variable declaration
Vs = 230.0             # supply voltage
Rmin= 1000.0           # minimum value of R1 resistor
Rmax = 22*10**3        # maximum value of R1 resistor
Vg = 2.0               # gate triggering voltage
C = 0.47*10**-6        # capacitor value
f = 50.0               # frequency
#Calculations
# For Rmin
theta = (180/math.pi)*math.atan(2*math.pi*f*C*Rmin)
theta = math.ceil(theta*10)/10
Vc = Vs*math.cos(theta*math.pi/180)
Vc = math.floor(Vc*100)/100
alfa = ((180/math.pi)*math.asin(Vg/(math.sqrt(2)*Vc)))+theta
alfa = math.floor(alfa*10)/10

# for Rmax
theta2 = (180/math.pi)*math.atan(2*math.pi*f*C*Rmax)
theta2 = math.ceil(theta2*10)/10
Vc2 = Vs*math.cos(theta2*math.pi/180)
Vc2 = math.floor(Vc2*100)/100
alfa2 = ((180/math.pi)*math.asin(Vg/(math.sqrt(2)*Vc2)))+theta2
alfa2 = math.ceil(alfa2*10)/10

#Result
print("Minimum firing angle = %.1f°"%alfa)
print("Maximum firing angle = %.1f°"%alfa2)

Minimum firing angle = 8.7°
Maximum firing angle = 74.1°


## example 2.31, Page No. 83¶

In :
# UJT relaxation oscillator design(reffering to fig.2.40)

import math
#variable declaration
f = 50.0                   # frequency of supply
Vbb = 12.0                 # typical input vpltage
P = 300*10**3              # maximumm average power dissipation
Rbb = 5.6*10**3            # base resistor
Iv = 4*10**-3              # Valley point voltage
h = 0.63                   # intrinsic stand off ratio
Vd = 0.5                   # drop across p-n junction
Vv = 2.0                   # Valley point voltage
Ip = 5*10**-6              # peak point current
v = 0.18                   # minimum voltage for which SCR will not trigger

#calculation
T = 1/f
#operating point should be on the left of valley point
R_1 = (Vbb-Vv)/Iv             # R should be greater than this value
Vp = (h*Vbb)+Vd
#operation point should lie in the negative resistance region of characteristics of UJT
R_2 = (Vbb-Vp)/Ip              # R should be less than this value
C = 0.02*10**-6               # assumed
R_3 = T/(C*math.log(1/(1-h)))

C2 = 0.04*10**-6               # assumed
R_4 = T/(C2*math.log(1/(1-h)))
R = 500*10**3                  # assumed
Rmax = R+R_1
R3_1 = (10**4)/(h*Vbb)
R3 = 1200                      # assumed
R4_1 = v*(R3+Rbb)/(Vbb-v)      # R4 value should be less than this value
R4 = 100                       # assumed
tw = R4*C2
tow_min = R_1*C2*math.log(1/(1-h))
alfa_min = tow_min*(360/T)
tow_max = Rmax*C2*math.log(1/(1-h))
alfa_max = tow_max*(360/T)

#Result
print("For C = %.2f micro F, R = %.2f k-ohm\nThis value of R is more than maximum of %d k-ohm."%(C*10**6,R_3/1000,R_2/1000) )
print("Hence not suitable.")
print("\nFor C = %.2f micro F, R = %.2f K-ohm."%(C2*10**6,R_4/1000))
print("As this is less than max value. It is suitable. \nLets assume R = %d k-ohm"%(R/1000))
print("Rmax = %.1f k-ohm"%(Rmax/1000))
print("\nR3 = %.2f k-ohm. so take nearest value R3 = %.1f k-ohm"%(R3_1/1000,R3/1000.0))
print("\nR4 = %.2f ohm. so take nearest value R4 = %.1f ohm"%(R4_1,R4))
print("\nMinimum firing angle = %.2f°"%alfa_min)
print("Maximum firing angle = %.1f°"%alfa_max)
print("\nThough maximum firing angle available is %.1f°, it will not be needed"%alfa_max)
print("because in a single phase full wave converter the maximum firing angle is 180°")

For C = 0.02 micro F, R = 1005.78 k-ohm
This value of R is more than maximum of 788 k-ohm.
Hence not suitable.

For C = 0.04 micro F, R = 502.89 K-ohm.
As this is less than max value. It is suitable.
Lets assume R = 500 k-ohm
Rmax = 502.5 k-ohm

R3 = 1.32 k-ohm. so take nearest value R3 = 1.2 k-ohm

R4 = 103.55 ohm. so take nearest value R4 = 100.0 ohm

Minimum firing angle = 1.79°
Maximum firing angle = 359.7°

Though maximum firing angle available is 359.7°, it will not be needed
because in a single phase full wave converter the maximum firing angle is 180°


## example 2.32, Page No.92¶

In :
# conduction time of thyristor

import math
#variable declaratrion
R =0.8                   # load resistance
L = 10*10**-6            # inductance
C = 50*10**-6            # capacitance

#calculations
R1 = math.sqrt(4*L/C)      # R should be less than this value
t = math.pi/(math.sqrt((1/(L*C))-((R**2)/(4*L**2))))

#Result
print("Value of sqrt(4L/C)  is %.4f and give R = %.1f\nTherefore, the circuit is underdamped."%(R1,R))
print("\nt0 = %.2f*10**-6 seconds"%(t*10**6))

Value of sqrt(4L/C)  is 0.8944 and give R = 0.8
Therefore, the circuit is underdamped.

t0 = 157.08*10**-6 seconds


## example 2.33, Page No. 92¶

In :
#Values of L and C

import math
#variable declaration
I = 8.0                  # load current
V = 90.0                 # Supply voltage
t = 40.0*10**-6          # turn off time

#calculation
#print("Assume peak value of capacitor current to be twice the load cuuren.")
C_by_L = (2*I/V)**2         # using eq 2.33
#print("Assume that thyristor is reverse biased for one-fourth period of resonant circuit.")
CL = (t*2/math.pi)**2
# (2*I/V)^2*L^2 =(t*2/math.pi)^2

L = math.sqrt(CL/C_by_L)
C =C_by_L*L

print("L = %.2f*10**-6 H\nC = %.3f*10**-6 F"%(L*10**6,C*10**6))

L = 143.24*10**-6 H
C = 4.527*10**-6 F


## example 2.34, Page No. 92¶

In :
#Value of C for commutation

import math
#variable declaration
R = 10                    # load resistace
V = 100                   # supply voltage
t = 50 * 10**-6           # turn off time

#Calculations
C = t/(R*math.log(2))

#Result
print("C = %.2f*10^-6 F"%(C*10**6))

C = 7.21*10^-6 F


## example 2.35, Page No. 93¶

In :
# L and C of commutation circuit

import math
# variable declaration
V = 100                    # supply voltage
I = 40                     # maximumm load current
T = 40*10**-6              # turn off time
t = 1.5                    # extra 50% tolerance

#Calculation
T = T*t
C = I*T/V
L = (V**2)*C/(I**2)
Ip = V*math.sqrt(C/L)
L2 = 2* 10**-4             # assume
Ip2 = V*math.sqrt(C/L2)
print("C = %.0f*10^-6 F\nL = %.1f*10^-4 H\nPeak capacitor current = %d A"%(C*10**6,L*10**4,Ip))
print("\nPeak capacitor current should be less than maximum load currentof %d A. If L is selected as %d *10^-4 H,"%(I,L2*10**4))
print("the peak capacitor current will be %.1f A. Since this is less than %d A, this value of L is satisfactory."%(Ip2,I))
print("\nHence,\nC = %.0f*10^-6 F\nL = %.1f*10^-4 H"%(C*10**6,L2*10**4))

C = 24*10^-6 F
L = 1.5*10^-4 H
Peak capacitor current = 40 A

Peak capacitor current should be less than maximum load currentof 40 A. If L is selected as 2 *10^-4 H,
the peak capacitor current will be 34.6 A. Since this is less than 40 A, this value of L is satisfactory.

Hence,
C = 24*10^-6 F
L = 2.0*10^-4 H


## example 2.36, Page No. 93¶

In :
# current rating of the thyristor

import math
#Variable declaration
Vdc = 100.0               # input voltage
L = 0.1 *10**-3           # Inductance
C = 10*10**-6             # capacitance
Vc = 100.0                # iinitial voltage on capacitor
t = 25.0*10**-6           # thyristor turn offf time
I = 10.0                  # Thyristor load current

#Calculations
t_off = Vc*C/I
Ic = Vdc*math.sqrt(C/L)

# Result
print("t_off = %d *10^-6 S\nt_off is more than thyristor turn off time and is thus sufficient to commutate the main circuit."%(t_off*10**6))
print("\nPeak capacitor current = %.2fA "%Ic)
print("Maximum current rating of thyristor should be more than %.2fA"%Ic)

t_off = 100 *10^-6 S
t_off is more than thyristor turn off time and is thus sufficient to commutate the main circuit.

Peak capacitor current = 31.62A
Maximum current rating of thyristor should be more than 31.62A


## example 2.37, Page No. 97¶

In :
# value of R and C for snubber circuit

import math
#variable declaration
dv_by_dt = 25*10**6                 # Thyristor's dv/dt rating
L = 0.2 *10**-3                     # source inductance
V = 230                             # Supply voltage
df = 0.65                           # damping factor

#Calculation
Vm = V*math.sqrt(2)
C = (1/(2*L))*(0.564*Vm/dv_by_dt)**2
R = 2*df*math.sqrt(L/C)

#Result
print("C = %.2f*10^-9 F\n\nR = %.1f ohm"%(C*10**9,R))

C = 134.62*10^-9 F

R = 50.1 ohm


## example 2.38, Page No.97¶

In :
# snuubber circuit parameters

import math
#variable declaration
V = 300.0                      # input voltage
Rl = 10.0                      # load resistance
f = 2000.0                     # operating frequency otf the circuit
dv_by_dt = 100.0*10**6         # required dv/dt  rating of the circuit
I = 100.0                      # discharge current

#calculations
#(a)
R = V/I
C = (1-(1/math.e))*Rl*V/(dv_by_dt*((R+Rl)**2))
C = math.floor(C*10**9)/10**9
#(b)
P = (C*V**2*f)/2

#Result
print("(a)\nR = %f ohm\nC = %.3f*10^-6 F"%(R,C*10**6))
print("\n(b)\nSnubber power loss = %.2f W"%P)
print("\nAll the energy stored in capacitor C is dissipated in resistance R. Hence power rating of R is %.2f W."%P)

(a)
R = 3.000000 ohm
C = 0.112*10^-6 F

(b)
Snubber power loss = 10.08 W

All the energy stored in capacitor C is dissipated in resistance R. Hence power rating of R is 10.08 W.


## example 2.39, Page No.98¶

In :
# maximum permissiible values of dv/dt and di/dt

import math
#variable declaration
R = 4.0              # resistance
L = 6.0*10**-6       # inductance
C = 6.0*10**-6       # capacitance
V = 300.0            # Supply voltage

#calculations
di_dt = V/L
Isc = V/R
dv_dt =(R* di_dt)+(Isc/C)

#Result
print("Maximum di/dt = %.0f*10^6 A/s\n\nmaximum permissible dv/dt = %.1f*10^6 V/s"%(di_dt*10**-6,dv_dt*10**-6))

Maximum di/dt = 50*10^6 A/s

maximum permissible dv/dt = 212.5*10^6 V/s


## example 2.40, Page No.98¶

In :
# snubber circuit designe

import math
#variable declaration

Rl = 8.0                 # load resistance
V = 230.0                # supply voltage
I = 200.0                # repititive peak current
di_dt = 40.0*10**6       # max. di/di rating
dv_dt = 150.0*10**6      # max. dv/dv rating
sf = 2.0                 # safety factor for thyristor

#Calculation

I1 = I/2.0
di_dt2 = di_dt/2.0
dv_dt2 = dv_dt/2
Vp = V*math.sqrt(2)
#Vp = math.floor((Vp*10)/10)
L2 = Vp/di_dt2
L2 = math.floor(L2*10**8)/10**8
R2 = L2*dv_dt2/Vp
Ip = Vp/Rl
Ic = (math.floor(Vp*10)/10)/R2
It = math.floor(Ip*100)/100+Ic
Ic_max = I1 - Ip
Ic_max = math.ceil(Ic_max*100)/100
R = Vp /Ic_max
R = math.ceil(R)
h = 0.65                  #assumed
C = 4*(h**2)*L2/R**2
dv_dt3 = Vp/((R+Rl)*C)

#Result
print("when safety factor is 2 ,maximum permisible ratings are:")
print("max. di/dt = %.0f*10^6 A/s\nmax. dv/dt = %.0f*10^6 V/s"%(di_dt2*10**-6,dv_dt2*10**-6))
print("\nPeak value of input voltage = %.1f V"%(math.floor(Vp*10)/10))
print("L = %.2f*10^-6 H \nR = %.2f ohm"%(L2*10**6,R2))
print("Peak load current = %.2fA\nPeak capacitor discharge current = %.2f A"%(math.floor(Ip*100)/100,Ic))
print("Total current through capacitor = %.2f"%It)
print("\nSince total current through capacitor is more than permissible vale. Hence max capacitor discharge current = %.2fA"%Ic_max)
print("R = %.0f ohm\nC = %.4f*10^-6F"%(R,C*10**6))
print("dv/dt = %.2f*10^6 V/s\nSince this value is within specified limit the design is safe. "%(math.floor(dv_dt3*10**-4)/100))
print("Hence, R = %d ohm, C = %.4f micro-F and L = %.2f micro-H"%(R,C*10**6,L2*10**6))

when safety factor is 2 ,maximum permisible ratings are:
max. di/dt = 20*10^6 A/s
max. dv/dt = 75*10^6 V/s

Peak value of input voltage = 325.2 V
L = 16.26*10^-6 H
R = 3.75 ohm
Peak load current = 40.65A
Peak capacitor discharge current = 86.74 A
Total current through capacitor = 127.39

Since total current through capacitor is more than permissible vale. Hence max capacitor discharge current = 59.35A
R = 6 ohm
C = 0.7633*10^-6F
dv/dt = 30.43*10^6 V/s
Since this value is within specified limit the design is safe.
Hence, R = 6 ohm, C = 0.7633 micro-F and L = 16.26 micro-H


## example 2.41, Page No. 100¶

In :
# Fault clearing time(referring to fig.2.59)

import math
#variable declaration
I2t = 30                # I2t rating of thyristor
V = 230                 # supply voltage
#For resistor values refer to fig 2.59
R1 = 2.0
R2 = 1.0
R3 = 5.0
R4 = 6.0
R5 = 5.0
#calculation
Rnet = R1+(R3*R2)/R4
If = math.sqrt(2)*V/Rnet
tc = I2t/(If**2)

#Result
print("tc = %.3f*10^-3 seconds "%(math.ceil(tc*1000*1000)/1000))

tc = 2.277*10^-3 seconds


## example 2.42, Page No.103¶

In :
# number of thyristors in series and parallel

import math
#variable declaration
V = 3*10**3                   # supply voltage
I = 750.0                     # supply current
V1 = 800.0                    # Thyristor voltage rating
I1 = 175.0                    # Thyristor current rating
d = 0.25                      # derating

# Calculation
np = I/((1-d)*I1)
ns = V/((1-d)*V1)
print("np = %.2f or %d"%(np,math.ceil(np)))
print("ns = %d"%(math.ceil(ns)))

np = 5.71 or 6
ns = 5


## example 2.43, Page No. 104¶

In :
# Value of R and C

import math
#variable declaration(referring to example 2.42)
V = 3*10**3                   # supply voltage
I = 750.0                     # supply current
V1 = 800.0                    # Thyristor voltage rating
I1 = 175.0                    # Thyristor current rating
d = 0.25                      # derating
Ib = 8*10**-3                 # maximum forward leakage current
del_Q = 30*10**-6             # recovery charge difference
ns = 5                        # number of series thyristors

#Calculations
R = ((ns*V1)-V)/((ns-1)*Ib)
C = (ns-1)*del_Q/(ns*V1-V)

#Result
print("R = %.2f*10^3 ohm\nC = %.2f*10^-6 F"%(R/1000,C*10**6))

R = 31.25*10^3 ohm
C = 0.12*10^-6 F


## example 2.44, Page No. 104¶

In :
# series resistance

import math
# variabe declaration
I1 = 200               # thyristor1 current rating
I2 = 300               # thyristor2 current rating
V1 = 1.5               # on state voltage drop of thyristor1
V2 = 1.2               # on state voltage drop of thyristor2

#Calculations
R = (V1-V2)/(I2-I1)

#Result
print("R = %.3f ohm"%R)

R = 0.003 ohm


## example 2.45, Page No.104¶

In :
# Thyristor parameters

import math
#variable declaration
ns = 12                 # no of series thyristors
V = 16*10**3            # maximum DC voltage rating
Ib = 10*10**-3          # maximum leakage current of thyristor
del_Q = 150 *10**-6     # recovery charge differences of thyristors
R = 56*10**3            # resistance
C = 0.5 *10**-6         # Capacitance

#Calculations
Vd1 = (V+(ns-1)*R*Ib)/ns
ssvd = 1-(V/(ns*Vd1))
Vd2 = (V+((ns-1)*del_Q/C))/ns
tsvd = 1-(V/(ns*Vd2))

#Result
print("(a) Maximum steady state voltage rating = %.2f V"%Vd1)
print("(b) Steady state voltage derating = %.3f or %.1f%%"%(ssvd,ssvd*100))
print("(c) Maximum transient state voltage rating = %.2f V"%Vd2)
print("(d) Transient state voltage derating = %.3f or %.1f%%"%(tsvd,tsvd*100))

(a) Maximum steady state voltage rating = 1846.67 V
(b) Steady state voltage derating = 0.278 or 27.8%
(c) Maximum transient state voltage rating = 1608.33 V
(d) Transient state voltage derating = 0.171 or 17.1%


## example 2.46, Page No.104¶

In :
# No of Thyristor

import math
#variable declaration
V = 500.0                # single thyristor voltage rating
I = 75.0                 # single thyristor current rating
Vmax = 7.5*10**3         # overall voltage rating of the circuit
Imax = 1.0*10**3         # overall current rating of the circuit
df = 0.14                # derating factor

#Calcaulations
ns = Vmax/((1-df)*V)
np = Imax/((1-df)*I)

#Result
print("No of thyristors in series, ns = %.2f say %d"%(ns,math.ceil(ns)))
print("No of thyristors in parallel, np = %.2f say %d"%(np,math.ceil(np)))

No of thyristors in series, ns = 17.44 say 18
No of thyristors in parallel, np = 15.50 say 16


## example 2.47, Page No. 105¶

In :
# Turn off voltage and discharge current through SCR

import math
#variable declaration
Vmax = 8.0*10**3             # max voltage rating of the circuit
R = 20.0*10**3               # static equalising resistance
Rc = 25.0                    # Resistace of dynamic equalising circuit
C = 0.1*10**-6               # Capacitance of dynamic equalising circuit
Ib1 = 22.0*10**-3            # leakage current of thyristor1
Ib2 = 20.0*10**-3            # leakage current of thyristor2
Ib3 = 18.0*10**-3            # leakage current of thyristor3

#Calculations
#(a)
I = ((Vmax/R)+(Ib1+Ib2+Ib3))/3
V1 = (I-Ib1)*R
V2 = (I-Ib2)*R
V3 = (I-Ib3)*R
#(b)
I1 = V1/Rc
I2 = V2/Rc
I3 = V3/Rc

#Result
print("Voltage across SCR 1 = %.1fV"%(math.floor(V1*10)/10))
print("Voltage across SCR 2 = %.1fV"%(math.floor(V2*10)/10))
print("Voltage across SCR 3 = %.1fV"%(math.floor(V3*10)/10))
print("Discharge current through SCR 1 = %.2fA"%(math.floor(I1*100)/100))
print("Discharge current through SCR 2 = %.2fA"%(math.floor(I2*100)/100))
print("Discharge current through SCR 3 = %.2fA"%(math.floor(I3*100)/100))

Voltage across SCR 1 = 2626.6V
Voltage across SCR 2 = 2666.6V
Voltage across SCR 3 = 2706.6V
Discharge current through SCR 1 = 105.06A
Discharge current through SCR 2 = 106.66A
Discharge current through SCR 3 = 108.26A