import math
# Variables
P = 1000.*10**3 #load power
phi = math.acos(math.radians(0.8)) #power factor lagging angle
V_L = 11.*10**3 #rated terminal voltae
R_a = 0.4 #armature resistance per phase
X_s = 3. #synchronous reactance per phase
# Calculations
I_L = P/(math.sqrt(3)*V_L*math.cos(math.radians(phi)))
I_aph = I_L #for star connected load
I_a = I_L #current through armature
V_ph = V_L/math.sqrt(3) #rated terminal volatge phase value
E_ph = math.sqrt( (V_ph*math.cos(math.radians(phi))+I_a*R_a)**2+(V_ph*math.sin(math.radians(phi))+I_a*X_s)**2 ) #emf generated phase value
E_line = E_ph*math.sqrt(3) #line value of emf generated
regulation = 100*(E_ph-V_ph)/V_ph #pecentage regulation
# Results
print 'Line value of e.m.f generated is %.2f kV \nRegulation is %.3f percent'%(E_line*10**-3,regulation)
# note : book answer is wrong.
import math
# Variables
VA = 1200.*10**3
V_L = 6600.
R_a = 0.25 #armature resistance per phase
X_s = 5. #synchronous reactance per phase
# Calculations and Results
I_L = VA/(math.sqrt(3)*V_L)
I_aph = I_L #for star connected load
I_a = I_L
V_ph = V_L/math.sqrt(3)
#Part(i)
phi1 = math.acos(0.8) #and lagging
E_ph1 = math.sqrt( (V_ph*math.cos(phi1)+I_a*R_a)**2+(V_ph*math.sin(phi1)+I_a*X_s)**2 )
regulation = 100*(E_ph1-V_ph)/V_ph #percentage regulation
print 'i)Regulation at 0.8 lagging pf is %.2f percent'%(regulation)
#Part(ii)
phi2 = math.acos(0.8) #and leading
E_ph2 = math.sqrt( (V_ph*math.cos(phi2)+I_a*R_a)**2+(V_ph*math.sin(phi2)-I_a*X_s)**2 )
regulation2 = 100*(E_ph2-V_ph)/V_ph #percentage regulation
print 'ii)Regulation at 0.8 leading pf is %.f percent'%(regulation2)
import math
# Variables
#full load
V_L_FL = 1100.
V_ph_FL = V_L_FL/math.sqrt(3)
# Calculations
#no load
V_L_NL = 1266
E_line = V_L_NL
E_ph = E_line/math.sqrt(3)
regulation = 100*(E_ph-V_ph_FL)/V_ph_FL
# Results
print 'Regulation at full load is %.2f percent'%(regulation)
import math
# Variables
V_L = 866.
VA = 100.*10**3
I_L = VA/(math.sqrt(3)*V_L) #because VA = math.sqrt(3)*V_L*I_L
I_aph = I_L #full load and star connected alternator
V_ph = V_L/math.sqrt(3)
# Calculations
#Graph is plotted and V_oc_ph and I_asc_Ph is obtained for
#SCC for I_asc = 66.67 A
I_f = 2.4 # A
#OCC for I_f = 2.4 A
V_oc_ph = 240 # V
#for measruemnt of impedance
V_oc_ph = 240 #for I_f = 2.4..From o.c.c graph
I_asc_ph = 66.67 #for I_f = 2.4...From s.c.c graph
Z_s = V_oc_ph/I_asc_ph
R_a = 0.15
X_s = math.sqrt( Z_s**2-R_a**2 )
V_ph_FL = 500.
phi = math.acos(0.8) #lagging pf
E_ph = math.sqrt((V_ph_FL*math.cos(phi)+I_aph*R_a)**2+(V_ph_FL*math.sin(phi)+I_aph*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
# Results
print 'Full-load regulation at 0.8 lagging pf is %.2f percent '%(regulation )
import math
# Variables
V_OC_line = 230.
I_asc = 12.5 # when I_f = 0.38
V_OC_ph = V_OC_line/math.sqrt(3)
Z_s = V_OC_ph/I_asc
R_a = 1.8/2 #1.8 is between terminals..0.9 is per phase
X_s = math.sqrt(Z_s**2-R_a**2)
I_a = 10. # when regulation is needed
V_L = 230.
V_ph = V_L/math.sqrt(3)
# Calculations and Results
#Part(i)
phi1 = math.acos(0.8) #and lagging
E_ph1 = math.sqrt((V_ph*math.cos(phi1)+I_a*R_a)**2+(V_ph*math.sin(phi1)+I_a*X_s)**2)
regulation1 = 100*(E_ph1-V_ph)/V_ph
print 'Regulation for 10 A at 0.8 lagging pf is %.2f percent'%(regulation1)
#Part(ii)
phi2 = math.acos(0.8) #and leading
E_ph2 = math.sqrt((V_ph*math.cos(phi2)+I_a*R_a)**2+(V_ph*math.sin(phi2)-I_a*X_s)**2)
regulation2 = 100*(E_ph2-V_ph)/V_ph
print 'Regulation for 10 A at 0.8 leading pf is %.2f percent'%(regulation2)
import math
# Variables
phi = math.acos(0.8)
VA = 1000.*10**3
V_L = 1905.
V_ph = V_L/math.sqrt(3)
R_a = 0.2 #Armature reactance per phase
# Calculations and Results
#Part(i)
#Ampere-turn method
I_L = VA/(math.sqrt(3)*V_L)
I_aph = I_L
V_dash = V_ph+I_aph*R_a*math.cos(phi) #V_dash is a dummy quantity and has no significance..it's used only for mapping correcponding current
F_o = 32 #F_o corresponds to voltage V_dash = 1148.5 from O.C.C graph
F_AR = 27.5 #Field current required to circulate full-load short circuit current of 303.07A.From SCC F_AR = 27.5
F_R = math.sqrt( F_o**2 + F_AR**2-2*F_o*F_AR*math.cos(phi+math.pi/2) ) #using Comath.sine rule
# for F_R = 53.25 E_ph = 1490 V from O.C.C
E_ph = 1490.
regulation1 = 100*(E_ph-V_ph)/V_ph
print 'Regulation on full-load by ampere-turn method is %.2f percent'%(regulation1)
#Part (ii)
#Synchronous Impedance method
I_sc = I_L
I_aph2 = I_sc
I_f = 27.5
V_OC_ph = 1060. #corresponding to I-f = 27.5 in the graph
Z_s = V_OC_ph/I_aph2
X_s = math.sqrt(Z_s**2-R_a**2)
E_ph2 = math.sqrt( (V_ph*math.cos(phi)+I_aph2*R_a)**2+(V_ph*math.sin(phi)+I_aph2*X_s)**2 ) #from phasor diagram
regulation2 = 100*(E_ph2-V_ph)/V_ph
print 'Regulation on full-load by synchronous impedance method is %.2f percent'%(regulation2)
import math
# Variables
#case(i)
V_L = 440.
V_ph = V_L/math.sqrt(3)
phi = math.acos(0.8)
#armature resistance drop from the graph
#RS = 1.1 cm and scale = 50 V/cm
arm_leak_resis = 1.1*50 #armature leakage resistance
OB = V_ph*math.cos(phi)
AB = V_ph*math.sin(phi) + arm_leak_resis
E_1ph = math.sqrt( OB**2+AB**2 )
F_f1 = 6.1 #corresponding value from OCC
F_AR = 3.1*1
# Calculations and Results
F_R = math.sqrt( F_f1**2 + F_AR**2 -2*F_f1*F_AR*math.cos(math.radians(90+math.acos(math.radians(0.8)))))
E_ph = 328. #voltage corresponding to F_R = 8.33 A from OCC graph
regulation1 = 100*(E_ph - V_ph)/V_ph
print 'i)Regulation for 0.8 pf lagging is %.2f percent '%(regulation1)
#case(ii)
OC = V_ph*math.cos(phi)
BC = V_ph*math.sin(phi) - arm_leak_resis
E_1ph = math.sqrt( OC**2+BC**2 )
F_f1 = 6.1 #corresponding value from OCC
F_R = math.sqrt( F_f1**2 + F_AR**2 -2*F_f1*F_AR*math.cos(math.radians(90-math.acos(math.radians(0.8)))))
E_ph = 90 #volatge corresponding to F_R = 3.34 A from OCC graph
regulation2 = 100*(E_ph - V_ph)/V_ph
print 'ii)Regulation for 0.8 pf leading is %.2f percent '%(regulation2)
print 'The answer in part ii doesnt match with textbook because of calculation mistake done in last step in the textbook'
import math
# Variables
P = 1200.*10**3
V_line = 12000.
R_a = 2.
X_s = 35. #armature resistance and synchronous reactance
phi = math.acos(0.8)
# Calculations
I_L = P/(math.sqrt(3)*V_line*math.cos(phi))
I_a = I_L
V_ph = V_line/math.sqrt(3)
E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2+(V_ph*math.sin(phi)+I_a*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
# Results
print 'Regulation at 0.8 lag power factor is %.2f percent'%(regulation)
import math
# Variables
V_L = 11000.
V_ph = V_L/math.sqrt(3)
VA = 1000.*1000
I_L = VA/(V_L*math.sqrt(3))
V_OC_ph = 433/math.sqrt(3)
I_asc_ph = I_L
Z_s = V_OC_ph /I_asc_ph #ohms per phase
R_a = 0.45 #ohms per phase
X_s = math.sqrt(Z_s**2-R_a**2)
# Calculations and Results
#part(i)
phi = math.acos(0.8) #lagging
E_ph = math.sqrt((V_ph*math.cos(phi)+I_L*R_a)**2 +(V_ph*math.sin(phi)+ I_L*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
print 'Voltage regulation at 0.8 pf lagging is %f percent'%(regulation)
#part(ii)
phi = math.acos(0.8) #leading
E_ph2 = math.sqrt((V_ph*math.cos(phi)+I_L*R_a)**2 +(V_ph*math.sin(phi)- I_L*X_s)**2)
regulation2 = 100*(E_ph2-V_ph)/V_ph
print 'Voltage regulation at 0.8 pf lagging is %f percent'%(regulation2)
print 'Answer mismatches due to improper approximation'
import math
# Variables
VA = 125.*10**3
V_L = 400.
V_ph = V_L/math.sqrt(3)
I_L = VA/(math.sqrt(3)*V_L)
I_aph = I_L
# Calculations
I_f = 4.
I_asc = I_aph/2 #for half load.. refer to graph
V_OC_line = 140.
V_OC_ph = V_OC_line/math.sqrt(3)
I_asc_ph = I_asc
Z_s = V_OC_ph/I_asc_ph
R_a = 0.1
X_s = math.sqrt(Z_s**2-R_a**2) #armature resistance and synchronous reactance
phi = math.acos(0.8)
E_ph = math.sqrt((V_ph*math.cos(phi)+I_asc*R_a)**2 +(V_ph*math.sin(phi)- I_asc*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
# Results
print 'Voltage regulation at 0.8 pf leading for half load is %.2f percent'%(regulation)
import math
from numpy import roots
# Variables
V_OC_line = 575.
V_OC_ph = V_OC_line/math.sqrt(3)
I_asc_line = 75.
I_asc_ph = I_asc_line
I_aph = I_asc_ph
I_L = I_aph
Z_s = V_OC_ph/I_asc_ph
R_a = 2.16/2
X_s = math.sqrt(Z_s**2 - R_a**2)
# Calculations and Results
#on full load
E_ph = 6100.
phi = math.acos(0.8) #leading
#using E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2 +(V_ph*math.sin(phi)- I_a*X_s)**2)
p = [1, -256.68, -3.71*10**7]
ans = roots(p)
V_ph = ans[0] #second root is ignored as its -ve
V_L = V_ph*math.sqrt(3)
print 'Rated terminal voltage between the lines is %.3f V '%(V_L)
VA_rating = math.sqrt(3)*V_L*I_L
print 'kVA rating of the alternator is %.f kVA'%(VA_rating*10**-3)
import math
from numpy import roots
# Variables
V_L = 6600.
V_ph = V_L/math.sqrt(3)
VA = 1500.*10**3
I_L = VA/(math.sqrt(3)*V_L)
I_aph = I_L
# Calculations and Results
R_a = 0.5
X_s = 5 #armature resistance and synchronous reactance
phi = math.acos(0.8)
E_ph = math.sqrt((V_ph*math.cos(phi)+I_aph*R_a)**2 +(V_ph*math.sin(phi)+ I_aph*X_s)**2)
print 'Induced EMF per phase is %f V'%(E_ph)
#full load
phi = math.acos(1)
#using E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2 +(V_ph*math.sin(phi)- I_a*X_s)**2)
p = [1, 131.215, -1.791*10**7]
ans = roots(p)
V_ph = ans[1] #first root is ignored as it is -ve
print 'Terminal voltage per phase is %f V'%(V_ph)
# note : rounding off error.
import math
# Variables
V_ph = 2000.
R_a = 0.8
I_sc = 100.
V_OC = 500.
I_f = 2.5
Z_s = V_OC/I_sc
X_s = math.sqrt(Z_s**2 - R_a**2 )
I_aFL = 100.
I_a = I_aFL
# Calculations and Results
#part(i)
phi = math.acos(1)
E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2 +(V_ph*math.sin(phi)+ I_a*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
print 'i)Voltage regulation is %.2f percent'%(regulation)
#part(ii)
phi2 = math.acos(0.8)
E_ph2 = math.sqrt((V_ph*math.cos(phi2)+I_a*R_a)**2 +(V_ph*math.sin(phi2)- I_a*X_s)**2)
regulation2 = 100*(E_ph2-V_ph)/V_ph
print 'ii)Voltage regulation is %.2f percent'%(regulation2)
#part(iii)
phi3 = math.acos(0.71)
E_ph3 = math.sqrt((V_ph*math.cos(phi3)+I_a*R_a)**2 +(V_ph*math.sin(phi3)+ I_a*X_s)**2)
regulation3 = 100*(E_ph3-V_ph)/V_ph
print 'iii)Voltage regulation is %.2f percent'%(regulation3)
import math
# Variables
VA = 1000.*1000
V_L = 4600.
V_ph = V_L/math.sqrt(3)
I_L = VA/(math.sqrt(3)*V_L)
I_aph_FL = I_L
I_aph = I_aph_FL
I_sc = (150./100)* I_aph_FL
V_OC_line = 1744
V_OC_ph = V_OC_line/math.sqrt(3)
# Calculations
Z_s = V_OC_ph / I_sc
R_a = 1
X_s = math.sqrt(Z_s**2-R_a**2)
phi = math.acos(0.8 ) #lagging
E_ph = math.sqrt((V_ph*math.cos(phi)+I_aph*R_a)**2 +(V_ph*math.sin(phi)+ I_aph*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
# Results
print 'Voltage regulation at full load 0.8 pf is %.2f percent'%(regulation)
import math
#part(i) Ampere turn method
# Variables
F_O = 37.5
F_AR = 20.
V_L = 6600.
V_ph = V_L/math.sqrt(3)
# Calculations and Results
#lagging
phi = math.acos(0.8)
F_R = math.sqrt((F_O+F_AR*math.sin(phi) )**2 + (F_AR*math.cos(phi))**2 )
#E_ph corresponding to F_R can be obtained by plotting open circuit characteristics
E_ph = 4350
regulation = 100*(E_ph-V_ph)/V_ph
print 'i)By Ampere-turn method or MMF methodFull-load regulation at 0.8 lagging pf is %.2f percent'%(regulation)
#leading
phi = math.acos(0.8)
F_R = math.sqrt((F_O-F_AR*math.sin(phi) )**2 + (F_AR*math.cos(phi))**2 )
#E_ph corresponding to F_R can be obtained by plotting open circuit characteristics
E_ph = 3000
regulation = 100*(E_ph-V_ph)/V_ph
print 'Full-load regulation at 0.8 leading pf is %.2f percent'%(regulation)
#EMF method
V_OC_ph = 100
V_ph = 100
I_sc = 100*(F_O/F_AR) #times the rated value
Z_s = V_OC_ph/I_sc
F_O = 100
F_AR = Z_s*100
#lagging
phi = math.acos(0.8)
F_R = math.sqrt((F_O+F_AR*math.sin(phi) )**2 + (F_AR*math.cos(phi))**2 )
regulation = 100*(F_R-V_ph)/V_ph
print 'iiSynchronous impedance method or EMF method'
print 'Full-load regulation at 0.8 lagging pf is %.2f percent'%(regulation)
#leading
phi = math.acos(0.8)
F_R = math.sqrt((F_O-F_AR*math.sin(phi) )**2 + (F_AR*math.cos(phi))**2 )
regulation = 100*(F_R-V_ph)/V_ph
print 'Full-load regulation at 0.8 leading pf is %.2f percent'%(regulation)
import math
# Variables
V_L = 6000.
V_ph = V_L/math.sqrt(3)
I_ph_X_Lph = 0.9*500 #leakage reactance drop in volts = 0.9 cm * 500 V/cm
phi = math.acos(0.8) #lagging
# Calculations
E_1ph = math.sqrt( (V_ph*math.cos(phi))**2 + (V_ph*math.sin(phi)+I_ph_X_Lph)**2 ) #From triangle OAB
F_f1 = 26 #from OCC
F_AR = 2.9*5 #2.9cm * 5 A/cm
F_R = math.sqrt(F_f1**2 + F_AR**2 -2*F_AR*F_f1*math.cos(phi+ (math.pi/2)) )
# Results
print 'Required field current is %.2f A'%(F_R)
import math
# Variables
V_L = 400.
V_ph = V_L/math.sqrt(3)
VA = 40.*10**3
I_L = VA/(math.sqrt(3)*V_L)
I_aph = I_L
# Calculations and Results
I_aph_X_Lph = 0.65*50 #leakage reactance drop in volts = 2.4 cm * 500 V/cm
X_Lph = I_aph_X_Lph/ I_aph
print 'Armature leakage reactance is %.3f ohms'%(X_Lph)
phi = math.acos(0.8) #lagging
E_ph = math.sqrt((V_ph*math.cos(phi))**2 +(V_ph*math.sin(phi)+ I_aph_X_Lph)**2)
F_f1 = 15.6 #as obtained from OCC corresponding to this E_ph
F_AR = 2.3*3 #2.3cm * 3 A/cm
print 'Armature reaction is %.1f '%(F_AR)
F_R = math.sqrt(F_f1**2 + F_AR**2 -2*F_AR*F_f1*math.cos(phi+ (math.pi/2)) ) #math.comath.sine rule to Triangle OAB
E_ph = 267.5 #corresponding to F_R from open circiut characteristics
regulation = 100*(E_ph-V_ph)/V_ph
print 'Voltage regulation at 0.8 pf lagging is %.1f percent'%(regulation)
#Note:This answer doesnt match with textbook as it has been reciprocated in textbook
import math
# Variables
VA = 10.*10**3
V_L = 11.*10**3
V_ph = V_L/math.sqrt(3)
I_ph_X_Lph = 2.4*500 #leakage reactance drop in volts = 2.4 cm * 500 V/cm
# Calculations
I_ph_R_aph = VA/(math.sqrt(3)*V_L)
phi = math.acos(0.8)
E_ph = math.sqrt((V_ph*math.cos(phi)+I_ph_R_aph)**2 +(V_ph*math.sin(phi)+ I_ph_X_Lph)**2)
F_f1 = 109 #obtained from open circuit characteristics corresponding to calculated E_ph
F_AR = 2.8*10 #2.8cm * 10 A/cm
F_R = math.sqrt(F_f1**2 + F_AR**2 -2*F_AR*F_f1*math.cos(phi+ (math.pi/2)) ) #math.comath.sine rule to Triangle OAB
E_ph = 7700. #corresponding to F_R from open circiut characteristics
regulation = 100*(E_ph-V_ph)/V_ph
# Results
print 'Voltage regulation at full-load 0.8 pf lagging is %.2f percent'%(regulation)
import math
from numpy import roots
# Variables
VA = 2000.*1000
V_L = 11000.
V_ph = V_L/math.sqrt(3)
R_a = 0.3
X_s = 5. #armature resistance and synchronous reactance
# Calculations
#case (i)
phi = math.acos(0.8) #lagging
I_L = VA/(math.sqrt(3)*V_L)
I_a = I_L
E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2 +(V_ph*math.sin(phi)+ I_a*X_s)**2)
#using E_ph = math.sqrt((V_ph*math.cos(phi)+I_aph*R_a)**2 +(V_ph*math.sin(phi)+ I_aph*X_s)**2)
#we get V_ph**2 -579.4455 V_ph -44653301.91 = 0
p = [1, -579.4455, -44653301.91]
ans = roots(p)
V_ph = ans[0] #second root is ignored as its -ve
print 'Terminal voltage is %.4f V'%(V_ph)
import math
from numpy import roots
# Variables
R_a = 0.6
X_s = 6. #armature resistance and synchronous reactance per phase
E_L = 6599.
E_ph = E_L/math.sqrt(3)
I_L = 180.
I_a = I_L
# Calculations and Results
#part(i)
# using E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2 +(V_ph*math.sin(phi)+ I_a*X_s)**2) and solving for V_ph
p = [1 ,1135.83, -13338836.49]
ans = roots(p)
V_ph = ans[1]
V_L = V_ph*math.sqrt(3)
regulation = 100*(E_ph-V_ph)/V_ph
phi = math.acos(0.9)
theta = math.atan((I_a*X_s+V_ph*math.sin(phi) )/(E_ph))
delta = theta-phi
print 'i)0.9 laggingTerminal voltage is %.2f VVoltage regulation is %.2f percentLoad angle is %.2f degrees'%(V_ph*math.sqrt(3),regulation,delta*180/math.pi)
#part(ii)
phi_2 = math.acos(0.8)
p = [1, -941.53, -11399574.87]
ans = roots(p)
V_ph = ans[0] #second root is ignored as its -ve
V_L = V_ph*math.sqrt(3)
regulation2 = 100*(E_ph-V_ph)/V_ph
delta_2 = math.asin( (math.tan(phi)*(V_ph*math.cos(phi_2)+I_a*R_a) -I_a*X_s )/E_ph )
print 'ii)0.8 leadingTerminal voltage is %.2f VVoltage regulation is %.2f percentLoad angle is %.2f degrees'%(V_L,regulation2,delta_2*180/math.pi)
import math
# Variables
V_ph = 2000.
R_a = 0.8
I_sc = 100.
I_a = I_sc
V_OC = 500.
I_f = 2.5
Z_s = V_OC/I_sc
X_s = math.sqrt(Z_s**2- R_a**2)
I_a_FL = 100.
# Calculations and Results
#Part(i)
phi1 = math.acos(1) #and lagging
E_ph1 = math.sqrt((V_ph*math.cos(phi1)+I_a*R_a)**2+(V_ph*math.sin(phi1)+I_a*X_s)**2)
regulation1 = 100*(E_ph1-V_ph)/V_ph
print 'Regulation at upf is %.2f percent'%(regulation1)
#Part(ii)
phi2 = math.acos(0.8)
E_ph2 = math.sqrt((V_ph*math.cos(phi2)+I_a*R_a)**2+(V_ph*math.sin(phi2)-I_a*X_s)**2)
regulation2 = 100*(E_ph2-V_ph)/V_ph
print 'Regulation at 0.8 leading pf is %.2f percent'%(regulation2)
#Part(iii)
phi3 = math.acos(0.71)
E_ph3 = math.sqrt((V_ph*math.cos(phi3)+I_a*R_a)**2+(V_ph*math.sin(phi3)+I_a*X_s)**2)
regulation3 = 100*(E_ph3-V_ph)/V_ph
print 'Regulation at 0.71 lagging pf is %.2f percent'%(regulation3)
import math
# Variables
V = 600.
VA = 60.*10**3
I_sc = 210.
V_oc = 480.
I_f = 10.
R_a = 0.2
I = VA/V #VA = V*I and alternator is math.single phase
I_a = I
# Calculations and Results
Z_s = V_oc/I_sc #Synchronous Impedance
X_s = math.sqrt(Z_s**2-R_a**2) #SYnchronous reactance
print 'Synchronous impedances is %f ohms and synchronous reactance is %f ohms'%(Z_s,X_s)
#PART (i)
phi1 = math.acos(0.8) #and lagging
E1 = math.sqrt((V*math.cos(phi1)+I_a*R_a)**2+(V*math.sin(phi1)+I_a*X_s)**2) #plus sign for lagging power factor
regulation1 = 100*(E1-V)/V
print 'Regulation at 0.8 lagging pf is %.2f percent '%(regulation1 )
#PART (ii)
phi2 = math.acos(1)
E2 = math.sqrt((V*math.cos(phi2)+I_a*R_a)**2+(V*math.sin(phi2)+I_a*X_s)**2)
regulation2 = 100*(E2-V)/V
print 'Regulation at UNITY pf is %.2f percent '%(regulation2 )
#PART (iii)
phi3 = math.acos(0.6) #and leading
E3 = math.sqrt((V*math.cos(phi3)+I_a*R_a)**2+(V*math.sin(phi3)-I_a*X_s)**2) #minus sign for leading power factor
regulation3 = 100*(E3-V)/V
print 'Regulation at 0.6 leading pf is %.2f percent '%(regulation3 )
import math
# Variables
V_L = 3300.
V_ph = V_L/math.sqrt(3)
I_a = 100.
I_f = 5.
V_OC_line = 900.
V_OC_ph = V_OC_line/math.sqrt(3)
R_a = 0.8 #armature resistance
I_aph = I_a
Z_s = V_OC_ph/I_aph
X_s = math.sqrt(Z_s**2-R_a**2) #synchronous reactance
# Calculations and Results
#Part(i)
phi1 = math.acos(0.8) #and lagging
E_ph1 = math.sqrt((V_ph*math.cos(phi1)+I_a*R_a)**2+(V_ph*math.sin(phi1)+I_a*X_s)**2)
regulation1 = 100*(E_ph1-V_ph)/V_ph
print 'Regulation at 0.8 lagging is %.2f percent'%(regulation1)
#Part(ii)
phi2 = math.acos(0.8) #and leading
E_ph2 = math.sqrt((V_ph*math.cos(phi2)+I_a*R_a)**2+(V_ph*math.sin(phi2)-I_a*X_s)**2)
regulation2 = 100*(E_ph2-V_ph)/V_ph
print 'Regulation at 0.8 leading pf is %.2f percent'%(regulation2)
import math
# Variables
V_L = 13500.
R_a = 1.5
X_s = 30. #armature resistance and synchronous reactance
V_ph = V_L/math.sqrt(3)
# Calculations and Results
#CASE 1
phi1 = math.acos(0.8)
P_out = 1280*10**3
I_L = P_out/ (math.sqrt(3)*V_L*math.cos(phi1) ) #because P_out = math.sqrt(3)*V_L*I_L*math.cos(phi)
I_a = I_L
E_ph = math.sqrt((V_ph*math.cos(phi1)+I_a*R_a)**2+(V_ph*math.sin(phi1)+I_a*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
print 'Regulation at 0.8 lagging power factor is %.2f percent'%(regulation)
#Case 2
phi2 = math.acos(1)
I_L = P_out/ (math.sqrt(3)*V_L*math.cos(phi2) ) #because P_out = math.sqrt(3)*V_L*I_L*math.cos(phi)
I_a = I_L
E_ph = math.sqrt((V_ph*math.cos(phi2)+I_a*R_a)**2+(V_ph*math.sin(phi2)+I_a*X_s)**2)
regulation2 = 100*(E_ph-V_ph)/V_ph
print 'Regulation at unity power factor is %.2f percent'%(regulation2)
#case 3
phi3 = math.acos(0.8)
I_L = P_out/ (math.sqrt(3)*V_L*math.cos(phi3) ) #because P_out = math.sqrt(3)*V_L*I_L*math.cos(phi)
I_a = I_L
E_ph = math.sqrt((V_ph*math.cos(phi3)+I_a*R_a)**2+(V_ph*math.sin(phi3)-I_a*X_s)**2) # minus sign in the second bracket beacuse of leading pf
regulation3 = 100*(E_ph-V_ph)/V_ph
print 'Regulation at 0.8 leading power factor is %.2f percent'%(regulation3)
# note : rounding off error
import math
# Variables
V_L = 11.*10**3
VA_rating = 10.**6
R_a = 2.2 #alternator resistance
phi = math.acos(0.8)
# Calculations
I_L = VA_rating/(math.sqrt(3)*V_L) #VA = math.sqrt(3)V_L*I_L
I_a = I_L
V_ph = V_L/math.sqrt(3)
regulation = 24.
E_ph = ((regulation/100)+1)*V_ph # because regulation = 100*(E_ph-V_ph)/V_ph
#using E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2+(V_ph*math.sin(phi)+I_a*X_s)**2)
X_s = (math.sqrt(E_ph**2-((V_ph*math.cos(phi)+I_a*R_a)**2))-V_ph*math.sin(phi))*(1/I_a)
phi1 = math.acos(0.8)
E_ph = math.sqrt((V_ph*math.cos(phi1)+I_a*R_a)**2+(V_ph*math.sin(phi1)-I_a*X_s)**2)
regulation1 = 100*(E_ph-V_ph)/V_ph
# Results
print 'Regulation at 0.8 leading power factor is %.2f percent'%(regulation1)
import math
# Variables
V_L = 220.
VA = 100.*10**3
R_a = 0.1 #effective resistacne of alternator
X_a = 0.5 #leakage reactance
X_ar = 2*X_a
Z_s = complex(R_a,X_a+X_ar)
# Calculations and Results
#Part(1)
phi = math.acos(0.4)
V_ph = V_L/math.sqrt(3)
I_L = VA/(math.sqrt(3)*V_L) #VA = math.sqrt(3)*V_L*I_L
I_a = I_L
E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2+(V_ph*math.sin(phi)+I_a*(X_a+X_ar))**2)
print 'i)Required noload voltage is %.3f V'%(E_ph)
#Part(2)
V_ph2 = 0
E_ph2 = math.sqrt((V_ph2*math.cos(phi)+I_a*R_a)**2+(V_ph2*math.sin(phi)+I_a*(X_a+X_ar))**2)
print 'ii)Required noload voltage is %.3f V'%(E_ph2)
import math
# Variables
V_L = 2000.
V_ph = V_L/math.sqrt(3)
VA = 1000.*10**3
I_L = VA/(math.sqrt(3)*V_L) #because VA = math.sqrt(3)*V_L*I_L
I_aph = I_L
I_f = 28.5 #for this I_aph = 288.67513 as obtained from SCC graph
V_oc_ph = 1060. #for I_f = 28.5 as obtained fromOCC graph
Z_s = V_oc_ph/I_aph
R_a = 0.2 #armature effective resistance
X_s = math.sqrt( Z_s**2-R_a**2 )
# Calculations and Results
#Part(i)
phi1 = math.acos(0.8) #lagging
E_ph1 = math.sqrt((V_ph*math.cos(phi1)+I_aph*R_a)**2+(V_ph*math.sin(phi1)+I_aph*X_s)**2)
regulation1 = 100*(E_ph1-V_ph)/V_ph
print "i)Full-load percentage regulation at 0.8 pf lagging is %.2f percent"%(regulation1)
#Part(ii)
phi2 = math.acos(0.8) #leading
E_ph2 = math.sqrt((V_ph*math.cos(phi2)+I_aph*R_a)**2+(V_ph*math.sin(phi2)-I_aph*X_s)**2)
regulation2 = 100*(E_ph2-V_ph)/V_ph
print "ii)Full-load percentage regulation at 0.8 pf leading is %.2f percent"%(regulation2)
print 'Note that the answer mismatches because of calculation mistake done in the last step of part 1'
import math
# Variables
V_L = 3300.
VA = 200.*10**3
R_a = 0.6
X_s = 6. #armature resistance and synchronous reactance
# Calculations
I_L = VA/(math.sqrt(3)*V_L) #VA = math.sqrt(3)V_L*I_L
I_a = I_L
V_ph = V_L/math.sqrt(3)
phi = math.acos(0.8)
E_ph = math.sqrt((V_ph*math.cos(phi)+I_a*R_a)**2+(V_ph*math.sin(phi)+I_a*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
# Results
print 'Regulation at 0.8 lagging power factor is %.3f percent'%(regulation)
print ' Note : Regulation is positive for lagging power factor loads'
import math
# Variables
V_L = 2300.
V_ph = V_L/math.sqrt(3)
f = 50.
R_a = 0.2 #armature resistance
I_sc = 150.
V_OC_line = 780.
V_OC_ph = V_OC_line/math.sqrt(3)
Z_s = V_OC_ph/I_sc
X_s = math.sqrt(Z_s**2 - R_a**2)
I_aph = 25
I_aFL = I_aph
# Calculations and Results
#part(i)
phi = math.acos(0.8) #lag
E_ph = math.sqrt((V_ph*math.cos(phi)+I_aph*R_a)**2 +(V_ph*math.sin(phi)+ I_aph*X_s)**2)
regulation = 100*(E_ph-V_ph)/V_ph
print 'Voltage regulation at 0.8 pf lagging is %.3f percent'%(regulation)
#part(ii)
phi2 = math.acos(0.8) #lead
E_ph2 = math.sqrt((V_ph*math.cos(phi2)+I_aph*R_a)**2 +(V_ph*math.sin(phi2)- I_aph*X_s)**2 )
regulation2 = 100*(E_ph2-V_ph)/V_ph
print 'Voltage regulation at 0.8 pf leading is %.3f percent'%(regulation2)