%pylab notebook

"""
Explanation: Excercises Electric Machinery Fundamentals
Chapter 6
Problem 6-31
End of explanation
"""


R1 =  0.54  # [Ohm]
R2 =  0.488 # [Ohm]
Xm = 51.12  # [Ohm]
X1 =  2.093 # [Ohm]
X2 =  3.209 # [Ohm]
Pcore = 150 # [W]
Pf_w  = 150 # [W]
Pmisc =  50 # [W]
V     = 460 # [V]
p     = 4
fse   = 60    # [Hz]

"""
Explanation: Description
When it is necessary to stop an induction motor very rapidly, many induction motor controllers reverse the direction of rotation of the magnetic fields by switching any two stator leads. When the direction of rotation of the magnetic fields is reversed, the motor develops an induced torque opposite to the current direction of rotation, so it quickly stops and tries to start turning in the opposite direction. If power is removed from the stator circuit at the moment when the rotor speed goes through zero, then the motor has been stopped very rapidly. This technique for rapidly stopping an induction motor is called plugging . The motor of Problem 6-21 is running at rated conditions and is to be stopped by plugging.
(a)

What is the slip s before plugging?

(b)

What is the frequency of the rotor before plugging?

(c)

What is the induced torque $\tau_\text{ind}$ before plugging?

(d)

What is the slip s immediately after switching the stator leads?

(e)

What is the frequency of the rotor immediately after switching the stator leads?

(f)

What is the induced torque $\tau_\text{ind}$ immediately after switching the stator leads?
End of explanation
"""


s = 0.02
print('''
s = {:.2f} 
========'''.format(s))

"""
Explanation: SOLUTION
(a)
The slip before plugging is (see Problem 6-21).
End of explanation
"""


fr = s * fse
print('''
fr = {:.1f} Hz
==========='''.format(fr))

"""
Explanation: (b)
The frequency of the rotor before plugging is:
$$f_r = sf_s$$
End of explanation
"""


tau_ind = 39.2   # [Nm]
print('''
tau_ind = {:.1f} Nm
================='''.format(tau_ind))

"""
Explanation: (c)
The induced torque before plugging in the direction of motion is (see Ch6-Problem 6-21).
End of explanation
"""


n_sync = -1800.0 # [r/min]
n_m = 1764.0     # [r/min]
s_after = (n_sync - n_m) / n_sync
print('''
s_after = {:.2f}
=============='''.format(s_after))

"""
Explanation: (d)
After switching stator leads, the synchronous speed becomes –1800 r/min, while the mechanical speed initially remains 1764&nbsp;r/min. 
Therefore, the slip becomes:
$$s = \frac{n_\text{sync} - n_{m}}{n_\text{sync}}$$
End of explanation
"""


fr_after = s_after * fse
print('''
fr_after = {:.1f} Hz
==================='''.format(fr_after))

"""
Explanation: (e)
The frequency of the rotor after plugging is
$$f_r = sf_e$$
End of explanation
"""


Zth = (Xm*1j * (R1 + X1*1j)) / (R1 + (X1 + Xm)*1j)
Zth_angle = arctan(Zth.imag / Zth.real)
print('Zth = ({:.4f})Ω = {:.3f} Ω ∠{:.1f}°'
      .format(Zth, abs(Zth), Zth_angle/pi *180))

"""
Explanation: (f)
The equivalent circuit for this motor is:
<img src="figs/Problem_6-31.jpg" width="70%">
The Thevenin equivalent of the input circuit is:
$$Z_{TH} = \frac{jX_M(R_1 + jX_1)}{R_1 + j(X_1 + X_M)}$$
End of explanation
"""


V_PHASE = V / sqrt(3)
VTH = (Xm*1j) / (R1 + (X1 + Xm)*1j) * V_PHASE
VTH_angle = arctan(VTH.imag / VTH.real)
print('VTH = {:.0f} V ∠{:.2f}°'
      .format(abs(VTH), VTH_angle/pi *180))

"""
Explanation: $$\vec{V}{TH} = \frac{jX_M}{R_1 + j(X_1 +X_M)}\vec{V}\phi$$
End of explanation
"""


Rth = Zth.real
Xth = Zth.imag
w_sync = abs(n_sync * (2*pi/60.0))
tau_ind = ((3 * abs(VTH)**2 * R2/s_after) /
           (w_sync * ((Rth + R2/s_after)**2 + (Xth + X2)**2)))
print('''
tau_ind = {:.1f} Nm, against the direction of motion
================================================='''.format(tau_ind))

"""
Explanation: The induced torque immediately after switching the stator leads is:
$$\tau_\text{ind} = \frac{3V^2_{TH}R_2/s}{\omega_\text{sync}[(R_{TH} + R_2/s)^2 + (X_{TH} + X_2)^2]}$$
End of explanation
"""


