print("Theoretical example")
print("Theoretical example")
# Half wave diode rectifier
import math
from scipy.integrate import quad
#Variable declaration
V = 12.0 # Voltage of the battery to be charged
B = 150.0 # battery capacity in Wh
I = 4.0 # average current requirement
t = 4.0 # transformer primary to secondary ratio
Vi = 230.0 # voltage at transformer primary
# Calculations
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vp = Vi*sqrt_2/t
#(a)
alfa = (180/math.pi)*(math.asin(V/Vp))
ang_c = (180-alfa)-alfa
ang_c = math.floor(ang_c*100)/100
#(b)
def f(wt):
return ((Vp*math.sin(wt))-V)/(2*math.pi*I)
wt_lower=(alfa*math.pi/180)
wt_upper =math.pi-(alfa*math.pi/180)
val1 = quad(f,wt_lower,wt_upper)
R = val1[0]
R = math.floor(R*100)/100
#(c)
def g(wt):
return (((Vp*math.sin(wt))-V)**2)/(2*math.pi*(R**2))
val2 = quad(g,wt_lower,wt_upper)
Irms = val2[0]
Irms = math.floor(math.sqrt(Irms)*100)/100
P = (Irms**2)*R
#(d)
T = B/(V*I)
#(e)
eff = (V*I)/((V*I)+P)
#(f)
PIV = Vp+V
#Results
print("(a) Conduction angle = %.2f°\n(b) R = %.2f ohm\n(c) Irms = %.2f A\n Resistor power rating = %.1f W"%(ang_c,R,Irms,P))
print("(d) Time of charging = %.3f hours\n(e) Rectifier efficiency = %.4f or %.2f%%\n(f) PIV = %.3f V"%(T,eff,eff*100,PIV))
#Full wave centre tapped rectifier
import math
# Variable declaration
Vm = 100.0 # transformer secondary voltage from mid point to each end
R = 5.0 # resistance
#Calculation
#(b)
Idc = 2*Vm/(math.pi*R)
Idc = math.floor(Idc*1000)/1000
Vdc = Idc*R
Irms = 0.707*Vm/R
Pdc = R*Idc**2
Pdc = math.ceil(Pdc*100)/100
Pac = R*Irms**2
Pac = math.ceil(Pac*10)/10
eff = Pdc/Pac
FF = math.floor(((0.707*Vm*math.pi)/(2*Vm))*100)/100
RF = math.sqrt((FF**2)-1)
TUF = (((2/math.pi)**2)/(2*0.707*0.5))*100
PIV =2*Vm
# Result
print("Idc = %.3f A\nVdc = %.2f V\nIrms = %.2f A\nPdc = %.2f\nPac = %.1f\nEfficiency = %.3f"%(Idc,Vdc,Irms,Pdc,Pac,eff))
print("FF = %.2f\nRF = %.3f\nTUF = %.2f%%\nPIV = %d\nCF = %f"%(FF,RF,TUF,PIV,math.sqrt(2)))
print("Theoretical example")
# Single phase diode bridge rectifier
import math
#Variable declaration
Vm = 100.0 # Peak input voltage
R = 5.0 # load resistance
#Calculation
#(b)
Idc = 2*Vm/(math.pi*R)
Idc = math.floor(Idc*1000)/1000
Vdc = Idc*R
Irms = 0.707*Vm/R
Pdc = R*Idc**2
Pdc = math.ceil(Pdc*100)/100
Pac = R*Irms**2
Pac = math.ceil(Pac*10)/10
eff = Pdc/Pac
FF = math.floor(((0.707*Vm*math.pi)/(2*Vm))*100)/100
RF = math.sqrt((FF**2)-1)
PIV =Vm
# Result
print("Idc = %.3f A\nVdc = %.2f V\nIrms = %.2f A\nPdc = %.2f\nPac = %.1f\nEfficiency = %.3f"%(Idc,Vdc,Irms,Pdc,Pac,eff))
print("FF = %.2f\nRF = %.3f\nPIV = %d\nCF = %f"%(FF,RF,PIV,math.sqrt(2)))
print("Theoretical example")
# Single phase half wave rectifier circuit
import math
# Variable declaration
Vm = 400 # amplitude of output sine wave
alfa = 30 # thyristor firing angle
R = 50 # Load resistance
#Calculations
alfa = alfa*math.pi/180
Vdc = Vm*(1+math.cos(alfa))/(2*math.pi)
I = Vdc/R
Vrms = Vm*math.sqrt(((math.pi-alfa)/(4*math.pi))+(math.sin(2*alfa)/(8*math.pi)))
Irms = Vrms/R
#Result
print("Average DC voltage = %.1f V\nAverage load current = %.3f A"%(Vdc,I))
print("RMS voltage = %.1f V\nRMS current = %.3f A"%(Vrms,Irms))
# Average current in the circuit
import math
from scipy.integrate import quad
#Variable declaration
Vm = 100.0 # peak input voltage
V = 50.0 # voltage of battery to be charged
R = 10.0 # load resistance
#Calculations
wt = math.asin(V/Vm)
wt2= math.pi-wt
def f(wt):
return ((Vm*math.sin(wt))-V)/(2*math.pi*R)
wt_lower=wt
wt_upper =wt2
val = quad(f,wt_lower,wt_upper)
i = val[0]
#Result
print("Average current in the circuit = %.2f A"%i)
# Average current
import math
from scipy.integrate import quad
#Variable declaration
Vm = 110.0 # peak input voltage
f = 50.0 # input frequency
Ra = 10.0 # motor armature resistance
E = 55.5 # back emf of the motor
#Calculations
wt = math.asin(E/(Vm*math.sqrt(2)))
wt2 = math.pi-wt
def f(wt):
return ((math.sqrt(2)*Vm*math.sin(wt))-E)/(2*math.pi*Ra)
wt_lower=wt
wt_upper =wt2
val = quad(f,wt_lower,wt_upper)
i = val[0]
#Result
print("Average current in the circuit = %.3f A"%i)
# Single phase half wave rectifier
import math
# Variable declaration
R = 15.0 # load resistance
V = 230.0 # supply voltage
alfa = math.pi/2 # firing angle
#Calculations
Vm = math.sqrt(2)*V
Vm = math.floor(Vm*10)/10
#(a)
Vdc = Vm*(1+math.cos(alfa))/(2*math.pi)
Vdc = math.ceil(Vdc*100)/100
Idc = Vdc/R
Idc = math.floor(Idc*100)/100
Vrms = Vm*math.sqrt(((math.pi-alfa)/(4*math.pi))+((math.sin(2*alfa))/(8*math.pi)))
Vrms = math.ceil(Vrms*100)/100
Irms =Vrms/R
Irms = math.floor(Irms*100)/100
#(b)
Pdc = Vdc*Idc
Pac = Vrms*Irms
eff = Pdc/Pac
#(c)
FF = Vrms/Vdc
RF = math.sqrt((FF**2)-1)
#(d)
VA = V*Irms
TUF = Pdc/VA
#(e)
PIV = Vm
#Result
print("(a)\nVdc = %.2f V\nIdc = %.2fA\nVrms = %.2f V\nIrms = %.2f A"%(Vdc,Idc,Vrms,Irms))
print("\n(b)\nRectification Efficiency = %.3f"%eff)
print("\n(c)\nForm Factor = %.2f\nRipple Factor = %.3f\n\n(d)\nTransformer utilization factor =%.4f\n\n(e)PIV = %.1f V"%(FF,RF,TUF,PIV))
# Single phase full wave rectifier
import math
#Variable declaration
V = 150.0 # input rms value
R = 30.0 # load resistance
alfa =(math.pi/180)*45 # firing angle
#Calculations
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vdc = V*sqrt_2*(1+math.cos(alfa))/math.pi
I = Vdc/R
Vrms = V*sqrt_2*math.sqrt(((math.pi-alfa)/(2*math.pi))+((math.sin(2*alfa))/(4*math.pi)))
Irms =Vrms/R
#Result
print("Vdc = %.2f V\nAverage load current = %.2f A\nVrms = %d V\nRMS load current = %.3f A"%(Vdc,I,Vrms,Irms))
# Transformer and thyristor parameters
import math
#Variable declaration
V = 230.0 # input to transformer primary
f = 50.0 # input frequency
Vdc = 100.0 # Average values of load voltage
Idc = 15.0 # Average value of load current
alfa = 30*(math.pi/180) # firing angle
d = 1.7 # drop across thyristor
#caculatios
#(a)
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = ((Vdc+d)*math.pi)/(2*math.cos(alfa))
Vm = math.floor(Vm*100)/100
Vrms = Vm/1.4109#math.sqrt(2)::to match the ans in book
N = V/Vrms
#(b)
Irms = math.sqrt((Idc**2)/2)
Irms = math.ceil(Irms*100)/100
Tr = 2*Vrms*Irms
#(c)
PIV = 2*Vm
#(d)
It = Irms
#Result
print("(a)\nVm = %.2f V\nRMS voltage of each half cycle of secondary = %.2f V\nTurn ratio of transformer = %.2f"%(Vm,Vrms,N))
print("\n(b)Transformer VA rating = %.1f VA\n\n(c)PIV = %.2f V\n\n(d)RMS value of thyristor current = %.2f A"%(Tr,PIV,It))
# thyristor rated voltage
import math
#Variable declaration
P = 10.0*10**3 # rectifier powwer rating
I = 50.0 # thyristor current rating
sf = 2 # safety factor
#Calculations
Idc = I
#(a)
Vdc = P/Idc
Vm = Vdc*math.pi/2
PIV = 2*Vm
Vt = 2*PIV
#(a)
Vt2 = 2*Vm
#Result
print("(a) Full wave centre tapped recifier:\n Thyristor voltage rating = %.2f V"%Vt)
print("\n(b) Full wave bridge rectifier:\n Thyristor voltage rating = %.2f V"%Vt2)
# output voltage, firing angle, load current
import math
from numpy import poly1d
#variable declaaration
V = 230.0 # input voltage
P = 1000.0 # output power rating
Pl = 800.0 # Actual power delivered
#Calculations
#(a)
Vrms = math.sqrt((Pl*V**2)/P)
Vrms = math.ceil(Vrms*100)/100
#(b)
#After solving equation using taylor seris of X, we got following coefficient.
P = poly1d([128.0/math.factorial(7),0,-32.0/math.factorial(5),0,8.0/math.factorial(3),0,0,(-2*math.pi*(1-(Vrms/V)**2))], variable = 'x')
x = P.r[(P.order+1)/2]*180/math.pi
alfa = math.ceil(x.real)
#(c)
I = Pl/Vrms
#Result
print("(a) Vrms = %.2f V\n(b) firing angle = %.0f°\n(c) Load current(rms value) = %.3f A"%(Vrms,alfa,I))
# Average power output
import math
#Variable declaration
V = 800.0 # thyristor peak voltage rating
I = 30.0 # average forward current
sf = 2.5 # safety factor
#Calculations
#(a)
Vm = V/(2*sf)
Vdc = 2*Vm/math.pi
Vdc = math.ceil(Vdc*100)/100
Idc = I/sf
P = Idc*Vdc
#(b)
Vm2 = V/sf
Vdc2 = 2*Vm2/math.pi
Vdc2 = math.ceil(Vdc2*100)/100
Idc2 = I/sf
P2 = Idc2*Vdc2
#Result
print("(a) In a mid point converter:\n Average output power = %.2f W"%P)
print("(b) In a Bridge converter:\n Average output power = %.2f W"%P2)
# Bridge converter parameters
import math
from scipy.integrate import quad
#Variable declaration
V = 230.0 # input voltage
R = 10.0 # load resistance
alfa = 30*math.pi/180 # firing angle
#Calculations
#(b)
Vm = math.sqrt(2)*V
def f(wt):
return math.sin(wt)
wt_lower1 = alfa
wt_upper1 = math.pi
wt_lower2 = math.pi
wt_upper2 = 2*math.pi
val1 = quad(f,wt_lower1,wt_upper1)
val2 = quad(f,wt_lower2,wt_upper2)
Vo =math.floor(((Vm/(2*math.pi))*(val1[0]-val2[0]))*10)/10
I = Vo/R
P = Vo*I
#result
print("DC power output = %.3f W"%P)
# output voltage and power
import math
#Variable declaration
V = 230.0 # input voltage
R = 10.0 # load resistance
#Calculations
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vo = 2*sqrt_2*V/math.pi
Vo = math.floor(Vo*100)/100
I = Vo/R
P = Vo*I
#Result
print("DC power = %.2f W"%P)
# Single phase bridge converter circuit
import math
#Variable declaration
V = 230.0 # input voltage
f = 50.0 # input frequency
I = 15.0 # constant load current
R = 0.5 # load resistance
L = 0.3 # inductance
E1 = 100 # back emf for case 1
E2 = -100 # back emf for case 2
#Calculations
#(a)
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = sqrt_2*V
alfa1 = (math.acos((E1+I*R)*math.pi/(2*Vm)))*(180/math.pi)
#(b)
alfa2 = (math.acos((E2+I*R)*math.pi/(2*Vm)))*(180/math.pi)
#(c)
OP1 = (E1*I)+(R*I**2)
OP2 = (E2*I)+(R*I**2)
IP = V*I
pf1 = OP1/IP
pf2 = -OP2/IP
print("(a) Firing angle = %.2f°"%(math.ceil(alfa1*100)/100))
print("(b) Firing angle = %.2f°"%alfa2)#Answer in the book is wrong
print("(c) when E = %d : input power factor= %.3f lagging\n When E = %d: input power factor= %.3f lagging"%(E1,pf1,E2,pf2))
# Average load current
import math
#Variable declaration
V = 230.0 # input voltage
f = 50.0 # frequency
R = 5.0 # load resistance
L = 8*10**-3 # inductance
E = 50.0 # back emf
alfa = 40*(math.pi/180) # firing angle
#Calculations
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = sqrt_2*V
I = ((2*Vm*math.cos(alfa)/math.pi)-E)/R
#Result
print("Average load current = %.2f A"%I)
# Transformer and thyristor parameters for full bridge circuit
import math
#Variable declaration
V = 230.0 # input to transformer primary
f = 50.0 # input frequency
Vdc = 100.0 # Average values of load voltage
Idc = 15.0 # Average value of load current
alfa = 30*(math.pi/180) # firing angle
d = 1.7 # drop across thyristor
#caculatios
#(a)
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = ((Vdc+2*d)*math.pi)/(2*math.cos(alfa))
Vrms = Vm/sqrt_2
N = V/Vrms
#(b)
Irms = Idc
Tr = Vrms*Irms
#(c)
PIV = Vm
#(d)
Itrms = Idc/sqrt_2
#Result
print("(a)\nVm = %.2f V\nRMS voltage of secondary = %.2f V\nTurn ratio of transformer = %.3f"%(Vm,Vrms,N))
print("\n(b)Transformer VA rating = %.1f VA\n\n(c) PIV = %.2f V\n\n(d)RMS value of thyristor current = %.2f A"%(math.ceil(Tr*10)/10,PIV,Itrms))
# Single phase semi-converter
import math
#Variable declaration
V = 230.0 # input voltage
f = 50.0 # frequency
alfa = 90*math.pi/180 # firing angle
# Calculation
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = sqrt_2*V
Vm = math.floor(Vm*10)/10
Vdc = Vm*(1+math.cos(alfa))/math.pi
Vrms = (Vm/sqrt_2)*math.sqrt(((math.pi-alfa)+((math.sin(2*alfa))/2))/math.pi)
FF = Vrms/Vdc
#Result
print("Vdc = %.2f V\nVrms = %.1f V\nForm factor = %.3f "%(Vdc,Vrms,FF))
# Single phase semi-converter Bridge circuit
import math
#Variable declaration
V = 230.0 # input voltage
f = 50 # frequency
alfa = 90*math.pi/180 # firing angle
#calculations
#(a)
print("(a) Theoretical Section")
#(b)
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = sqrt_2*V
Vdc = Vm*(1+math.cos(alfa))/math.pi
Vdc = math.floor(Vdc*100)/100
pi = math.floor(math.pi*1000)/1000
Vrms = (Vm/sqrt_2)*math.sqrt(((math.pi-alfa)+((math.sin(2*alfa))/2))/pi)
Is = math.sqrt(1-((alfa)/math.pi))
Is1 = 2*sqrt_2*math.cos(alfa/2)/math.pi
HF = math.sqrt((Is/Is1)**2-1)
theta = -alfa/2
DF = math.cos(theta)
Pf = Is1*math.cos(theta)/Is
#Result
print("(b)\nVdc = %.2f V\nVrms = %.2f V\nHarmonic factor = %.3f"%(Vdc,Vrms,HF))
print("Displacement factor = %.4f\nInput power factor = %.4f lagging"%(DF,Pf))
# Single phasefull converter
import math
#Variable declaration
V = 230.0 # input voltage
f = 50 # frequency
alfa = math.pi/3 # firing angle
#calculations
#(a)
print("(a) Theoretical Section")
#(b)
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = sqrt_2*V
Vdc = 2*Vm*math.cos(alfa)/math.pi
Vdc = math.floor(Vdc*100)/100
Vrms = V
Is = 1
Is1 = 2*sqrt_2/math.pi
HF = math.sqrt((Is/Is1)**2-1)
theta = -alfa
DF = math.cos(theta)
Pf = Is1*math.cos(theta)/Is
#Result
print("(b)\nVdc = %.2f V\nVrms = %d V\nHarmonic factor = %.3f"%(Vdc,Vrms,HF))
print("Displacement factor = %.1f\nInput power factor = %.2f lagging"%(DF,Pf))
# Single phase fully controlled bridge converter
import math
# Variable declaration
V = 230.0 # input voltage
alfa = 30*math.pi/180 # firing angle
I = 4 # Constant load current
#calculations
#(a)
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = sqrt_2*V
Vdc = math.floor((2*Vm*math.cos(alfa)/math.pi)*10)/10
R = Vdc/I
Il = math.floor((2*sqrt_2*I/math.pi)*10)/10
APi = V*Il*math.cos(alfa)
RPi = V*Il*math.sin(alfa)
App_i = V*Il
#(b)
Vdc1 = Vm*(1+math.cos(alfa))/3.1414#To adjust
Vdc1 = math.ceil(Vdc1*1000)/1000
Il1 = math.ceil((Vdc1/R)*100)/100
Il_2 = math.ceil((2*sqrt_2*Il1*math.cos(alfa/2)/math.pi)*100)/100
APi1 = V*Il_2*math.cos(alfa/2)
RPi1 = V*Il_2*math.sin(alfa/2)
App_i1 = V*Il_2
#(c)
Vdc3 = V*(1+math.cos(alfa))/(math.pi*sqrt_2)
Idc = math.floor((Vdc3/R)*100)/100
#Result
print("(a)\n Vdc = %.1f V\n Load resistance = %.3f ohm\n Active power input = %.2f W"%(Vdc,R,APi))
print(" Reactive power input = %d vars\n Appearent power input = %d VA"%(RPi,App_i))
print("\n(b)\n Vdc = %.3f V\n Load current = %.2f A\n Active power input = %.1f W"%(Vdc1,Il_2,APi1))
print(" Reactive power input = %.2f vars\n Appearent power input = %.1f VA"%(RPi1,App_i1))
print("\n(c)\n Vdc = %.3f V\n Average dc output current = %.2f A"%(Vdc3,Idc))
# single phase fully controlled bridge converter with R-L load
import math
#Variable declaration
V = 230 # input voltage
alfa = 30*math.pi/180 # firing angle
I = 10 # constant load current
#Calculations
#(a)
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = sqrt_2*V
Vdc = math.floor((2*Vm*math.cos(alfa)/math.pi)*10)/10
#(b)
Irms = I
#(c)
Is = I
Is1 = 2*sqrt_2*I/math.pi
#(d)
DF = math.cos(-alfa)
#(e)
pf = math.floor((Is1*DF/Is)*1000)/1000
#(f)
HF = math.sqrt(((Is/Is1)**2)-1)
#(g)
FF = V/Vdc
RF = math.ceil((math.sqrt(FF**2-1))*1000)/1000
#Result
print("(a) DC output voltage = %.1f V\n(b) RMS input current = %d A"%(Vdc,Irms))
print("(c) RMS value of fundamental Is1 = %.0f A\n(d) Displacement factor = %.3f "%(Is1,DF))
print("(e) Input power factor = %.3f lagging\n(f) Harmonic factor = %.3f\n(g) Form Factor = %.3f\t\tRipple Factor = %.3f"%(pf,HF,FF,RF))
# Half controlled bridge converter
import math
#Variable declaration
alfa = 60*math.pi/180 # firing angle
V = 240 # input voltage
R = 10 # Load current
#Calculations
#(a)
sqrt_2 = math.floor(math.sqrt(2)*1000)/1000
Vm = sqrt_2*V
Vdc = Vm*(1+math.cos(alfa))/math.pi
#(b)
I = math.floor((Vdc/R)*1000)/1000
Is = I*(1-alfa/math.pi)**(0.5)
#(c)
Is1 = 2*sqrt_2*I*math.cos(alfa/2)/math.pi
fi = -alfa/2
DF =math.cos(fi)
pf = Is1*DF/Is
#(d)
P = I**2*R
#Result
print("(a) Vdc = %.2f\n(b) Load current = %.3f A\n(c) Displacement factor = %.3f\n Input power factor = %.3f"%(Vdc,I,DF,pf))
print("(d) Average power dissipated in load = %.2f W"%P)
# Fully controlled three-phase bridge rectifier
import math
#Variable declaration
I = 200.0 # AC line current
Vac = 400.0 # AC line voltage
Vdc = 360.0 # DC voltage
var = 0.1 # 10% line volatge variation
#Calculation
#(a)
alfa = math.acos(Vdc*math.pi*math.sqrt(3)/(3*math.sqrt(3)*Vac*math.sqrt(2)))*(180/math.pi)
#(b)
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
S = I*Vac*sqrt_3
P = S*math.ceil(math.cos(alfa*math.pi/180)*10000)/10000
Q = math.sqrt(S**2-P**2)
#(c)
Vac1 = (1+var)*Vac
alfa2 =math.acos(Vdc/(3*Vac1*math.sqrt(2)/math.pi))*180/math.pi
Vac2 = (1-var)*Vac
alfa3 =math.acos(Vdc/(3*Vac2*math.sqrt(2)/math.pi))*180/math.pi
#Result
print("(a) firing angle = %.1f°\n(b) P = %.1f W\n Q = %.1f vars"%(S,P,Q))
print("(c) When ac line voltage is %d V : alfa = %.1f°\n When ac line voltage is %d V : alfa = %.1f°"%(Vac1,alfa2,Vac2,alfa3))
# 3-phase full converter
import math
#Variable declaration
V = 400.0 # 3-phase input voltage
I = 150.0 # Average load current
alfa = 60*math.pi/180 # firing angle
#Calculations
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
Vm = math.ceil((sqrt_2*V/sqrt_3)*100)/100
Vdc =269.23#3*math.sqrt(3)*Vm*math.cos(alfa)/math.pi-->answer is not matching to that of book
#(a)
Pdc = Vdc*I
#(b)
Iavg = I/3
Irms = I*math.sqrt(2.0/6)
Vp = math.sqrt(2)*V
#Result
print("(a) Output power = %.1f W\n(b)\nAverage thyristor current = %d A\nRMS value of thyristor current = %.1f A"%(Pdc,Iavg,Irms))
print("Peak current through thyristor = %d A\n(c) Peak inverse voltage = %.1f V"%(I,math.floor(Vp*10)/10))
# 3-phase fully controlled bridge converter
import math
#variable declaration
V = 400.0 # line to line input voltage
R = 100.0 # load resistance
P = 400.0 # power supplied to load
#Calculations
Vrms = math.sqrt(V*R)
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
Vm = math.ceil((sqrt_2*V/sqrt_3)*100)/100
#(a)
alfa = math.acos((((Vrms/(sqrt_3*Vm))**2)-0.5)*(4*math.pi/(3*sqrt_3)))
alfa= (alfa/2)*(180/math.pi)
#(b)
I = math.sqrt(V/R)
Is = math.floor(math.sqrt(2*120.0/180.0)*100)/100
#(c)
app_i=sqrt_3*V*Is
#(d)
pf = V/app_i
#Result
print("(a) alfa = %.1f°\n(b) RMS value of input current = %.2f A"%(alfa,Is))
print("(c) Input apparent power = %.2f VA\n(d) power factor = %.1f lagging"%(app_i,pf))
# six pulse thyristor converter
import math
#Variable declaration
Vac = 415.0 # input AC voltage
Vdc = 460.0 # DC output voltage
I = 200.0 # load current
#Calculation
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
#(a)
Vm = math.floor((sqrt_2*Vac/sqrt_3)*10)/10
alfa =math.ceil((Vdc*math.pi/(Vm*3*sqrt_3))*1000)/1000
alfa = math.acos(alfa)*(180/math.pi)
#(b)
P = Vdc*I
#(c)
Iac = I*(120.0/180.0)**(0.5)
#(d)
Irms =I*(120.0/360.0)**(0.5)
#(e)
Iavg =math.floor(I*100/3)/100
#Result
print("(a) alfa = %.2f°\n(b) DC power = %d kW\n(c) AC line current = %.1f A"%(alfa,P/1000,Iac))
print("(d) RMS thyristor current = %.1f A\n(e) Average thyristor current = %.2f A"%(Irms,Iavg))
# Firing angle and input power factor
import math
#Variable declaration
V = 230.0 # input voltage
E = 200.0 # battery emf
R = 0.5 # battery internal resistance
I = 20.0 # current
#Calculations
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
#(a)
Vm = math.floor((sqrt_2*V/sqrt_3)*10)/10
Vdc = E+I*R
pi = math.floor(math.pi*1000)/1000
alfa =Vdc*pi/(Vm*3*sqrt_3)
alfa = math.acos(alfa)*(180/math.pi)
alfa = math.ceil(alfa*100)/100
P = (E*I)+(I**2*R)
Is = ((I**2)*120.0/180.0)**(0.5)
pf = P/(sqrt_3*V*Is)
#Result
print("Firing angle = %.2f°\nInput power factor = %.3f lagging"%(alfa,pf))
# 3-phase semi-converter bridge circuit
import math
#Variable declaration
V = 400.0 # input voltage
R = 10.0 # load resistance
#Calculations
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
Vm = math.ceil((V*sqrt_2/sqrt_3)*100)/100
#(a)
alfa = (math.pi)/3 #as load current continuous
Vdc1 = 3*1.7267*Vm*(1+math.cos(alfa))/(2*math.pi)#To match the answer to book's ans
Vdc1 = math.floor(Vdc1*100)/100
Vmax = 3*1.7267*Vm*(1+math.cos(0))/(2*math.pi)
Vmax = math.floor(Vmax*100)/100
Vdc = Vmax/2
alfa2 = math.acos((Vdc*2*math.pi/(3*sqrt_3*Vm))-1)
#(b)
Idc = Vdc/R
#(c)
Vrms = sqrt_3*Vm*((3.0/(4*math.pi))*(math.pi-alfa2+(math.sin(2*alfa2))/2.0))**(0.5)
Vrms = 345.3#Vrms ans not matches with book's ans
Irms = Vrms/R
#(d)
It = Idc/3
Itrms = Irms/sqrt_3
#(e)
eff = (Vdc*Idc)/(Vrms*Irms)
#(f)
Ilrms = Irms*(120.0/180.0)**(0.5)
VA = Ilrms*V*3/sqrt_3
TUF = (Vdc*Idc)/(VA)
#(g)
APO = Irms**2*R
pf = APO/VA
#Result
print("(a) Firing angle = %.0f°\n(b) Vdc = %.3fV\n Idc = %.2f A\n(c) Vrms = %.1f V\tIrms = %.2f A"%(alfa2*180/math.pi,Vdc,Idc,Vrms,Irms))
print("(d) Average thyristor current = %.2f A\t RMS thyristor current = %.2f A"%(It,Itrms))
print("(e) rectification efficiency = %.3f or %.1f%%\n(f) TUF = %.2f\n(g) Input power factor = %.2f lagging"%(eff,eff*100,TUF,pf))
# 3-phase fully controlled bridge converter
import math
#Variable declaration
V = 400.0 # input voltage
R = 10.0 # load resistance
#Calculations
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
Vm = math.ceil((V*sqrt_2/sqrt_3)*100)/100
#(a)
alfa = (math.pi)/3 #as load current continuous
Vdc = 3*1.7267*Vm*(math.cos(alfa))/(math.pi)#To match the answer to book's ans
Vdc = math.ceil(Vdc*100)/100
#(b)
Idc = Vdc/R
#(c)
Vrms = sqrt_3*Vm*(0.5+((3*1.7321*math.cos(2*alfa))/(4*math.pi)))**(0.5)
Vrms = 305.35#Vrms ans not matches with book's ans
Irms = Vrms/R
#(d)
It = Idc/3
Itrms = Irms/sqrt_3
#(e)
eff = (Vdc*Idc)/(Vrms*Irms)
#(f)
Ilrms = Irms*(120.0/180.0)**(0.5)
VA = Ilrms*V*3/sqrt_3
TUF = math.floor(((Vdc*Idc)/(VA))*1000)/1000
#(g)
APO = Irms**2*R
pf = APO/VA
#Result
print("(a) Vdc = %.2fV\n(b) Idc = %.2f A\n(c) Vrms = %.2f V\tIrms = %.2f A"%(Vdc,Idc,Vrms,Irms))
print("(d) Average thyristor current = %.2f A\t RMS thyristor current = %.2f A"%(It,Itrms))
print("(e) rectification efficiency = %.3f or %.1f%%\n(f) TUF = %.3f\n(g) Input power factor = %.2f lagging"%(eff,eff*100,TUF,pf))
print("Theoretical Example")
print("Theoretical Example")
# Firing angle of converter
import math
#Variable declaration
V = 400.0 # input voltage
E = 300.0 # back emf of the motor
#Calculations
Vm = math.sqrt(2)*V
alfa = math.acos(E*2*math.pi/(3*math.sqrt(3)*Vm))
alfa = alfa*(180/math.pi)
#Result
print("Firing angle, alfa = %.1f°"%alfa)
# Overlap angle
import math
#Variable declaration
V = 400.0 # input voltage
f = 50 # input frequency
I = 200.0 # load current
L = 0.2 *10**-3 # Source inductance
alfa1 = 20*math.pi/180 # firing angle for case 1
alfa2 = 30*math.pi/180 # firing angle for case 2
alfa3 = 60*math.pi/180 # firing angle for case 3
#Calculations
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
Vm = math.ceil((V*sqrt_2/sqrt_3)*100)/100
E = 3*2*math.pi*f*L*I/math.pi
Vo = 3*sqrt_3*Vm/math.pi
#(a)
mu1 = math.acos((Vo*math.cos(alfa1)-E)/Vo)-alfa1
mu1 = mu1*180/math.pi
mu1 = math.ceil(mu1*10)/10
#(b)
mu2 = math.acos((Vo*math.cos(alfa2)-E)/Vo)-alfa2
mu2 = mu2*180/math.pi
#(a)
mu3 = math.acos((Vo*math.cos(alfa3)-E)/Vo)-alfa3
mu3 = mu3*180/math.pi
#Result
print("(a) for alfa = %.0f°:\n\t mu = %.1f°"%(alfa1*180/math.pi,mu1))
print("\n(b) for alfa = %.0f°:\n\t mu = %.2f°"%(alfa2*180/math.pi,mu2))
print("\n(c) for alfa = %.0f°:\n\t mu = %.2f°"%(alfa3*180/math.pi,mu3))
# peak circulating current and peak current of converter
import math
#Variable declaration
V = 230.0 # Input voltage
f = 50 # frequency
R = 15 # load resistance
a1 = 60*math.pi/180 # firing angle 1
a2 = 120*math.pi/180 # firing angle 2
L = 50*10**-3 # inductance
#Variable declaration
Vm = math.sqrt(2)*V
w = 2*math.pi*f
wl = w*L
wt = 2*math.pi
ir = 2*Vm*(math.cos(wt)-math.cos(a1))/wl
ir = math.floor(ir*10)/10
Ip = Vm/R
I = ir+Ip
#Result
print("Peak circulating current = %.1f A\nPeak current of converter 1 = %.2f A"%(ir,I))
# single phase circulating current dualconverter
import math
#Variable declaration
V = 230.0 # input voltage
f = 50 # frequency
a1 = 30*math.pi/180 # firing angle 1
a2 = 150*math.pi/180 # firing angle 2
R = 10 # Load resistance
I = 10.2 # Peak current
#Calculation
#(a)
Vm = math.sqrt(2)*V
w = 2*math.pi*f
wt = 2*math.pi
L = 2*Vm*(math.cos(wt)-math.cos(a1))/(w*I)
#(b)
Ip = Vm/R
I1 = math.floor((I+Ip)*100)/100
#Result
print("L = %.4f H\npeak current of converter 1 = %.2f A"%(L,I1))
# single phase circulating current dualconverter
import math
#Variable declaration
V = 230.0 # input voltage
f = 50 # frequency
a1 = 45*math.pi/180 # firing angle 1
a2 = 135*math.pi/180 # firing angle 2
I = 39.7 # Peak current of converter
Ic = 11.5 # peak circulating current
#Calculation
#(a)
Vm = math.sqrt(2)*V
Vm = math.floor(Vm*10)/10
w = 2*math.pi*f
wt = 2*math.pi
x = math.floor(math.cos(a1)*1000)/1000
L = 2*Vm*(math.cos(wt)-x)/(w*Ic)
#(b)
Ip = I-Ic
R = Vm/Ip
#Result
print("L = %.4f H\nR = %.3f Ohm"%(L,R))
#answer for L is wrong in the book
# 3-phase dual converter
import math
#Variable declaration
V = 400 # input voltage
f = 50 # frequency
L = 60*10**-3 # inductance
wt1 = 0 # phase 1
wt2 = 30*math.pi/180 # phase 2
wt3 = 90*math.pi/180 # phase 3
alfa = 0 # firing angle
#Calculations
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
Vm = math.ceil((V*sqrt_2/sqrt_3)*100)/100
wl = 2*math.pi*f*L
ir1 = 3*Vm*(math.sin(wt1-wt2)-math.sin(alfa))/wl
ir2 = 3*Vm*(math.sin(wt2-wt2)-math.sin(alfa))/wl
ir3 = 3*Vm*(math.sin(wt3-wt2)-math.sin(alfa))/wl
ir4 = 3*Vm*(math.sin(wt3)-math.sin(alfa))/wl
#Result
print("For wt = %.0f anf alfa = %d, ir = %.3f A"%(wt1*180/math.pi,alfa,ir1))
print("For wt = %.0f anf alfa = %d, ir = %.0f A"%(wt2*180/math.pi,alfa,ir2))
print("For wt = %.0f anf alfa = %d, ir = %.0f A"%(wt3*180/math.pi,alfa,ir3))
print("Peak value of circulaing current, ir = %.2f A"%(ir4))
# 3-phase circulating current dual converter
import math
#Variable declaration
V = 400.0 #input voltage
f = 50.0 # frequency
I = 42.0 # peak value of circulating current
alfa = 0 # firing angle
a1 = 30*math.pi/180 #
wt = 120*math.pi/180 # wt for max current
#Calculations
sqrt_2 =math.floor(math.sqrt(2)*1000)/1000
sqrt_3 =math.floor(math.sqrt(3)*1000)/1000
Vm = math.ceil((V*sqrt_2/sqrt_3)*100)/100
w = 2*math.pi*f
L = 3*Vm*(math.sin(wt-a1)-math.sin(alfa))/(w*I)
#Result
print("L = %.3f H"%L)