import math
#initialisation of variables
#calculate power fed to load
V=100.0
#Calculations
Va=(V/(math.sqrt(2)*math.pi))*(2+1/math.sqrt(2))
Rd=10.0
Pa=Va**2/Rd
#Results
print(Pa,'load power(W)')
import math
#initialisation of variables
#calculate firing angle value
Po=15000.0
Ro=1.5
Va=math.sqrt(Po*Ro)
#Calculations
a=math.degrees(math.acos((Va*2*math.pi/(3*math.sqrt(6)*V))-1))
print(a,'firing angle(deg)')
Ia=Va/Ro
Ith=Ia/3.0
#Results
print(Ith,'avg current through diodes(A)')
import math
#initialisation of variables
#calculate value of commutating capacitor
Iamax=100.0
V=100.0
f_max=400.0
#Calculations
c=Iamax/(2*V*f_max)
#Results
print(c,'value of commutating capacitor(F)')
import math
#initialisation of variables
#to determine value of capacitor
f=50.0
w=2*math.pi*f
Z_lm=complex(3,2.7)
Z_la=complex(7,3)
#Calculations
I_m=(-1)*math.degrees(math.atan((Z_lm.imag)/(Z_la.imag)))
a=90.0
I_a=a+I_m
c=1/(w*((Z_lm.real)-(Z_la.real)*math.cos(math.radians((-1)*I_a))))
#Results
print(c,'value of capacitor(F)')
import math
#initialisation of variables
#to calculate starting torque and atarting current,motor performance
V_a=110*complex(math.cos(math.radians(90)),math.sin(math.radians(90)))
V_m=220*complex(math.cos(math.radians(0)),math.sin(math.radians(0)))
R_1=3
R_2=2.6
X_1=2.7
X_2=2.7
X=110
V_f=(1.0/2)*(V_m-1j*V_a)
V_b=(1.0/2)*(V_m+1j*V_a)
Z_f=(complex(0,X)*complex(R_2,X_2))/(complex(0,X)+complex(R_2,X_2))
Z_b=Z_f
Z_ftot=complex(R_1,X_1)+Z_f
Z_btot=complex(R_1,X_1)+Z_b
I_f=V_f/Z_ftot
I_b=V_b/Z_btot
T_s=(2/157)*(Z_f.real)*(abs(I_f)**2-abs(I_b)**2)
print(T_s,'starting torque(Nm)')
I_m=I_f+I_b
I_a=1j*(I_f-I_b)
print(abs(I_a),'starting current(A)')
s=0.04
Z_f=(complex(0,X)*complex(R_2/s,X_2))/(complex(0,X)+complex(R_2/s,X_2))
Z_b=(complex(0,X)*complex(R_2/(2-s),X_2))/(complex(0,X)+complex(R_2/(2-s),X_2))
Z_ftot=complex(R_1,X_1)+Z_f
Z_btot=complex(R_1,X_1)+Z_b
I_f=V_f/Z_ftot
I_b=V_b/Z_btot
w_s=157.1
T_s=(2/157.1)*(abs(I_f)**2*(Z_f.real)-abs(I_b)**2*(Z_b.real))
print(T_s,'starting torque(Nm)')
I_m=I_f+I_b
#Calculations
m=math.degrees(math.atan((I_m.imag)/(I_m.real)))
I_a=1j*(I_f-I_b)
a=math.degrees(math.atan((I_a.imag)/(I_a.real)))
P_m=w_s*(1.0-s)*T_s
P_L=200.0
P_out=P_m-P_L
P_min=V*abs(I_m)*math.cos(math.radians(m))
P_ain=V*abs(I_a)*math.cos(math.radians(a))
P_in=P_min+P_ain
n=P_out/P_in
print(n,'efficiency')
r=Z_ftot/Z_btot #r=V_mf/V_bf
#V_mf+V_bf=220
V_mf=220/(1+r)
V_mb=220-V_mf
V_a=1j*(V_mf-V_mb)
#Results
print(abs(V_a),'V_a(V)')