# input voltage, SCR ratings and input power factors
import math
#variable declaration
V = 250 # single phase supply voltage
I = 50 # supply current
pf = 0.8 # lagging power factor
alfa = 0 # ideal SCR
#calculations
x = math.sqrt(2)
x = math.floor(x*1000)/1000
Vm = (V*math.pi*x)/(3*math.sin(math.pi/3))
Vrms = Vm/math.sqrt(2)
Irms = I*math.sqrt(2)/math.sqrt(3)
y = math.sqrt(3)
y = math.floor(y*1000)/1000
piv = y*Vm
piv = math.floor(piv*100)/100
Ii = math.sqrt((I**2)/3)
pipp = V*I*pf/3.0
pf_i = pipp/(Vrms*Ii)
#Result
print("Vm = %f V\nrms current rating of thyristor = %.1f A\nPIV = %.2fV\nRMS value of input current = %.1f A"%(Vm,math.ceil(Irms),piv,Ii))
print("Power input per phase = %.2f W\nInput power factor = %.3f lagging."%(pipp,pf_i))
#output voltage(referring ex 7.1)
import math
#variable declaration
V = 250 # single phase supply voltage
theta1 = 30 # firing angle 1
theta2 = 45 # firing angle 2
#calculations
#(a)
v1 = V*math.cos(theta1*math.pi/180)
#(b)
v2 = V*math.cos(theta2*math.pi/180)
#Result
print("(a) RMS value of output voltage = %.1f V"%v1)
print("(b) RMS value of output voltage = %.2f V"%v2)
#Output voltage for different firing angle
import math
#variable declaration
Vrms = 230 # input voltage
theta1 = 0 # firing angle 1
theta2 = 30 # firing angle 2
#calculation
#(a)
v1 = 6*math.sqrt(2)*Vrms*math.sin(math.pi/6)*math.cos(theta1*math.pi/180)/(math.pi*math.sqrt(2))
#(b)
v2 = 6*math.sqrt(2)*Vrms*math.sin(math.pi/6)*math.cos(theta2*math.pi/180)/(math.pi*math.sqrt(2))
#Result
print("(a) Vo = %.2f V\n(b) Vo = %.1f V"%(v1,v2))
# supply voltage
import math
#variable declaration
Vo = 200 # output voltage
#Calculation
Vi = Vo*(math.pi/3)/math.sin(math.pi/3)
#Result
print("RMS value of input voltage = %.2f V "%Vi)