%pylab notebook

"""
Explanation: Excercises Electric Machinery Fundamentals
Chapter 4
Problem 4-14
End of explanation
"""


If   =   2.5 # [A]
Vocc = 440.0 # [V]
Isc  = 100.0 # [A]

"""
Explanation: Description
During a short-circuit test, a Y-connected synchronous generator produces 100 A of short-circuit armature
current per phase at a field current of 2.5 A. At the same field current, the open-circuit line voltage is
measured to be 440 V.
(a)

Calculate the saturated synchronous reactance under these conditions.

(b)
If the armature resistance is $0.3\,\Omega$ per phase, and the generator supplies 60 A to a purely resistive Y-connected load ~~of 3&nbsp;Ohms per phase at this~~ at a matching field current setting, 

Determine the voltage regulation under these load conditions.

SOLUTION
(a)
The saturated synchronous reactance at a field current of 2.5 A can be found from the information
supplied in the problem. The open circuit line voltage at $I_F = 2.5\,A$ is 440 V, and the short-circuit current is 100 A.
End of explanation
"""


Vphi = Vocc / sqrt(3)
print('Vphi = {:.0f} V'.format(Vphi)) 

"""
Explanation: Since this generator is Y-connected, the corresponding phase voltage is:
End of explanation
"""


Ia = Isc
Xs = Vphi / Ia
print('''
Xs = {:.2f} Ω
==========='''.format(Xs))

"""
Explanation: and the armature current is $I_A = I_{SC}$ . Therefore, the saturated synchronous
reactance is:
End of explanation
"""


Vl_desired = 440   # [V]
Ra         =   0.3 # [Ohm]
Ia_b       =  60.0 # [A]
EA         = Vphi + Ra * Ia_b + Xs*1j * Ia_b
EA_angle   = arctan(EA.imag/EA.real)
print('EA = {:.0f} V ∠{:.1f}°'.format(abs(EA), EA_angle/pi*180))

"""
Explanation: (b)
Assume that the desired line voltage is 440 V, which means that the phase voltage $\vec{V}_\phi = 254\,V\angle 0°$ (as calulated above).
The armature current is $\vec{I}_A = 60\,A \angle 0°$, so the internal generated voltage is:
$$\vec{E}A = \vec{V}\phi + R_A\vec{I}_A + jX_S\vec{I}_A$$
End of explanation
"""


Vl_nl = abs(EA) * sqrt(3)
print('Vl_nl = {:.0f} V'.format(Vl_nl))

"""
Explanation: This is also the phase voltage at no load conditions. The corresponding line voltage at no load conditions
would be:
End of explanation
"""


VR = (Vl_nl - Vl_desired) / Vl_desired
print('''
VR = {:.1f} %
==========='''.format(VR*100))

"""
Explanation: The voltage regulation is:
$$VR = \frac{V_\text{T,nl} - V_\text{T,fl}}{V_\text{T,fl}} \cdot 100\%$$
End of explanation
"""


