%pylab notebook

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


R1 =  0.10   # [Ohm]
R2 =  0.07   # [Ohm]
Xm = 10.0    # [Ohm]
X1 =  0.21   # [Ohm]
X2 =  0.21   # [Ohm]
Pfw   = 500  # [W]
Pmisc =   0  # [W]
Pcore = 400  # [W]
V     = 208  # [V]

"""
Explanation: Description
A 208-V four-pole 60-Hz Y-connected wound-rotor induction motor is rated at 30 hp. Its equivalent circuit components are:
| Stator               | Rotor                | Power
|----------------------|----------------------|--------------------------|
| $R_1 = 0.10\,\Omega$ | $R_2 = 0.07\,\Omega$ | $P_\text{core} = 400\,W$ |
| $X_1 = 0.21\,\Omega$ | $X_2 = 0.21\,\Omega$ | $P_\text{f\&w} = 500\,W$ |
| $X_M = 10.0\,\Omega$ |                      | $P_\text{misc}\approx 0$ |
End of explanation
"""


s = 0.05
Z2 = R2 + R2*(1-s)/s + X2*1j
Zf = 1/(1/(Xm*1j) + 1/Z2)
Zf_angle = arctan(Zf.imag / Zf.real)
print('Zf = ({:.3f}) Ω = {:.3f} Ω ∠{:.1f}°'.format(Zf, abs(Zf), Zf_angle/pi*180))

"""
Explanation: For a slip of 0.05, find
(a)

The line current $I_L$

(b)

The stator copper losses $P_\text{SCL}$

(c)

The air-gap power $P_\text{AG}$

(d)

The power converted from electrical to mechanical form $P_\text{conv}$

(e)

The induced torque $\tau_\text{ind}$

(f)

The load torque $\tau_\text{load}$

(g)

The overall machine efficiency

(h)

The motor speed in revolutions per minute and radians per second

SOLUTION
The equivalent circuit of this induction motor is shown below:
<img src="figs/Problem_6-05_a.jpg" width="70%">
(a)
The easiest way to find the line current (or armature current) is to get the equivalent impedance $Z_F$ of the rotor circuit in parallel with $jX_M$ , and then calculate the current as the phase voltage divided by the sum of the series impedances, as shown below.
<img src="figs/Problem_6-05_b.jpg" width="70%">
The equivalent impedance of the rotor circuit in parallel with $jX_M$ is:
$$Z_F = \frac{1}{\frac{1}{jX_M}+\frac{1}{Z_2}}$$
End of explanation
"""


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

"""
Explanation: The phase voltage is
End of explanation
"""


Rf = Zf.real
Xf = Zf.imag
Ia = Vphi / (R1 + X1*1j + Rf + Xf*1j)
Ia_angle = arctan(Ia.imag/Ia.real)
Il = Ia
print('''
Il = Ia = {:.1f} A ∠{:.1f}°
========================''' .format(abs(Il), Ia_angle/pi *180))

"""
Explanation: so line current $I_L$ is:
$$I_L = I_A = \frac{V_\phi}{R_1+jX_1+R_F+jX_F}$$
End of explanation
"""


Pscl = 3 * abs(Ia)**2 * R1
print('''
Pscl = {:.0f} W
============='''.format(Pscl))

"""
Explanation: (b)
The stator copper losses are
$$P_\text{SCL} = 3I_A^2R_1$$
End of explanation
"""


Pag = 3 * abs(Ia)**2 * Rf - Pcore
print('''
Pag = {:.1f} kW
============='''.format(Pag/1000))

"""
Explanation: (c)
The equivalent circuit did not take into account the core losses by way of $R_m$, instead they were explicitely given. 
Now the the air gap power is:
$$P_\text{AG} = P_\text{in} - P_\text{SCL} - P_\text{core}$$
$$P_\text{AG} = 3I_2^2\frac{R_2}{s} = 3I_A^2R_F - P_\text{core}$$
<hr>
Note that $3I_A^2R_F - P_\text{core}$ is equal to $3I_2^2\frac{R_2}{s}$, since the only resistance in the original rotor circuit was $\frac{R_2}{s}$ , and the resistance in the Thevenin equivalent circuit is $R_F$. The power consumed by the Thevenin equivalent circuit should be the same as the power consumed by the original circuit. But the Thevenin circuit we use here is missing the $R_m$ part. As an excercise you could calculate $R_m$ from $P_\text{core}$ and then determin the Thevenin impedance as follows: 
$$Z_F = \frac{1}{\frac{1}{R_m} + \frac{1}{jX_M}+\frac{1}{Z_2}}$$
This however is not done here and we simply substract the core losses directly.
<hr>
End of explanation
"""


Pconv = (1 - s) * Pag
print('''
Pconv = {:.1f} kW
==============='''.format(Pconv/1000))

"""
Explanation: (d)
The power converted from electrical to mechanical form is:
$$P_\text{conv} = (1-s)P_\text{AG}$$
End of explanation
"""


n_sync = 1800  # [r/min]
w_sync = n_sync * (2.0*pi /1.0) * (1.0 / 60.0)
tau_ind = Pag / w_sync
print('''
tau_ind = {:.1f} Nm
=================='''.format(tau_ind))

"""
Explanation: (e)
The induced torque in the motor is:
$$\tau_\text{ind} = \frac{P_\text{AG}}{\omega_\text{sync}}$$
End of explanation
"""


Pout = Pconv - Pfw - Pcore - Pmisc
print('Pout = {:.1f} kW'.format(Pout/1000))

"""
Explanation: (f)
The output power of this motor is:
$$P_\text{OUT} = P_\text{conv} - P_\text{f\&w} - P_\text{core} - P_\text{misc}$$
End of explanation
"""


n_m = (1 - s) * n_sync
print('n_m = {:.0f} r/min'.format(n_m))

"""
Explanation: The output speed is:
$$n_m = (1-s)n_\text{sync}$$
End of explanation
"""


w_m = n_m * (2.0*pi /1.0) * (1.0 / 60.0)
tau_load = Pout / w_m
print('''
tau_load = {:.1f} Nm
==================='''.format(tau_load))

"""
Explanation: Therefore the load torque is:
$$\tau_\text{load} = \frac{P_\text{OUT}}{\omega_m}$$
End of explanation
"""


eta = Pout / (3 * Vphi * abs(Ia) * cos(Ia_angle)) * 100
print('''
η = {:.1f} %
=========='''.format(eta))

"""
Explanation: (g)
The overall efficiency is:
$$\eta = \frac{P_\text{OUT}}{P_\text{IN}} \cdot 100\% = \frac{P_\text{OUT}}{3V_\phi I_A\cos\theta}$$
End of explanation
"""


w_m = n_m * (2*pi / 60.0)
print('''
w_m = {:.0f} rad/s
==============='''.format(w_m))

"""
Explanation: (h)
The motor speed in revolutions per minute is $n_m$. The motor speed in radians per second is:
End of explanation
"""


