# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Excercises Electric Machinery Fundamentals
# ## Chapter 4

# ## Problem 4-2

# + slideshow={"slide_type": "skip"}
# %pylab notebook
# %precision 0
# -

# ### Description

# Given a 13.8-kV, 50-MVA, 0.9-power-factor-lagging, 60-Hz, four-pole, Y-connected synchronous machine with:
#
# * a synchronous reactance of $2.5\,\Omega$ 
# * an armature resistance of $0.2\,\Omega$.
# * at 60 Hz, its friction and windage losses are 1 MW
# * its core losses are 1.5 MW. 
# * The field circuit has a dc voltage of 120 V,
# * the maximum $I_F$ is 10 A. The current of the field circuit is adjustable over the range from 0 to 10 A. 
#
# The OCC of this generator is shown in Figure P4-1 below
# <img src="figs/FigC_P4-1.jpg" width="70%">

Vl = 13.8e3    # [V] 
PF = 0.9
Xs = 2.5       # [Ohm]
Ra = 0.2       # [Ohm]
P      =  50e6 # [W]
Pf_w   = 1.0e6 # [W]
Pcore  = 1.5e6 # [W]
Pstray =     0 # [W]
n_m = 1800     # [r/min]

# #### (a)
#  * How much field current is required to make the terminal voltage $V_T$ (or line voltage $V_L$ ) equal to 13.8 kV when the generator is running at no load?
#  
# #### (b)
#  * What is the internal generated voltage $E_A$ of this machine at rated conditions?
#  
# #### (c)
#  * What is the phase voltage $V_\phi$ of this generator at rated conditions?
#  
# #### (d)
#  * How much field current is required to make the terminal voltage $V_T$ equal to 13.8 kV when the generator is running at rated conditions?
#  
# #### (e)
# Suppose that this generator is running at rated conditions, and then the load is removed without changing the field current. 
#  
#  * What would the terminal voltage of the generator be?
#  
# #### (f)
#  * How much steady-state power and torque must the generator’s prime mover be capable of supplying to handle the rated conditions?
#  
# #### (g)
#  * Construct a capability curve for this generator.

# ### SOLUTION

# #### (a)
# If the no-load terminal voltage is 13.8 kV, the required field current can be read directly from the open-circuit characteristic. It is $\underline{\underline{I_F = 3.50\,A}}$.

# #### (b)
# This generator is Y-connected, so $I_L = I_A$ . At rated conditions, the line and phase current in this generator is:
#
# $$I_A = I_L = \frac{P}{\sqrt{3}V_L}$$

ia = P / (sqrt(3) * Vl)
Ia_angle = -arccos(PF)
Ia = ia * (cos(Ia_angle) + sin(Ia_angle)*1j)
print('Ia = {:.0f} A ∠{:.1f}°'.format(abs(Ia), Ia_angle/pi *180))

# The phase voltage of this machine is:
# $$V_\phi = V_T / \sqrt{3}$$

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

# The internal generated voltage of the machine is:
# $$\vec{E}_A = \vec{V}_\phi + R_A\vec{I}_A + jX_S\vec{I}_A$$

Ea = V_phase + Ra*Ia + Xs*1j*Ia
Ea_angle = arctan(Ea.imag/Ea.real)
print('''
Ea = {:.0f} V ∠{:.1f}°
=================='''.format(abs(Ea), Ea_angle/pi*180))

# #### (c)
# The phase voltage of the machine at rated conditions is:

print('''
V_phase = {:.0f} V
================'''.format(V_phase))

# #### (d)
# The equivalent open-circuit terminal voltage corresponding to an $E_A$ of the value calculated in **(b)** is:

Vt_oc = sqrt(3) * abs(Ea)
print('Vt_oc = {:.0f} kV'.format(Vt_oc/1000))

# From the OCC, the required field current is $\underline{\underline{I_F = 10\,A}}$.

# #### (e)
# If the load is removed without changing the field current then $V_\phi = E_A$:

abs(Ea)

# The corresponding terminal voltage would be $\underline{\underline{V_T = 20\,kV}}$.

# #### (f)
# The input power to this generator is equal to the output power plus losses. The rated output power is:

Pout = P*PF
print('Pout = {:.0f} MW'.format(Pout/1e6))

# $$P_{CU} = 3I^2_AR_A$$

Pcu = 3 * abs(Ia)**2 * Ra
print('Pcu = {:.1f} MW'.format(Pcu/1e6))

Pin = Pout +Pcu + Pf_w + Pcore + Pstray
print('Pin = {:.1f} MW'.format(Pin/1e6))

# Therefore the prime mover must be capable of supplying $P_{in}$. Since the generator is a four-pole 60 Hz machine, to must be turning at 1800 r/min. The required torque is:
#
# $$\tau_{app} = \frac{P_{in}}{\omega_m}$$

w_m = n_m * (2*pi/60.0)
tau_app = Pin / w_m
print('''
tau_app = {:.0f} Nm
==================='''.format(tau_app))

# #### (e)
# The rotor current limit of the capability curve would be drawn from an origin of:
#
# $$Q = -\frac{3V^2_\phi}{X_S}$$

Q = - (3 * V_phase**2) / Xs
print('Q = {:.2f} Mvar'.format(Q/1e6))

# The radius of the rotor current limit is:
#
# $$D_E = \frac{3V_\phi E_A}{X_S}$$

De = (3 * V_phase * abs(Ea)) / Xs
print('De = {:.0f} Mvar'.format(De/1e6))

# The stator current limit is a circle at the origin of radius:
#
# $$S = 3V_\phi I_A$$

S = 3 * V_phase * abs(Ia)
print('S = {:.0f} Mvar'.format(S/1e6))

# Get points for stator current limit:

theta = arange(-95,95) # angle in degrees
rad = theta * pi/180   # angle in radians
s_curve = S * ( cos(rad) + sin(rad)*1j)

# Get points for rotor current limit:

orig = Q*1j
theta = arange(65,115)  # angle in degrees
rad = theta * pi / 180  # angle in radians
r_curve = orig + De * ( cos(rad) + sin(rad)*1j )

# Plot the capability diagram:

fig= figure()
ax=fig.add_subplot(1, 1, 1)
ax.plot(real(s_curve/1e6),imag(s_curve/1e6),'b')
ax.plot(real(r_curve/1e6),imag(r_curve/1e6),'r--')
ax.set_title('Synchronous Generator Capability Diagram')
ax.set_xlabel('Power (MW)')
ax.set_ylabel('Reactive Power (Mvar)')
ax.set_aspect('equal', 'datalim')
ax.legend(('stator current limit', 'rotor current limit'), loc=3);
ax.grid()

StarcoderdataJupyterScriptsDedupFiltered