%pylab notebook
%precision %.4g

"""
Explanation: Excercises Electric Machinery Fundamentals
Chapter 7
Problem 7-1
End of explanation
"""


B   =   0.4  # [T]
V_B =  48    # [V]
l   =   0.5  # [m]
R   =   0.4  # [Ohm]
r   =   0.25 # [m]
w   = 500    # [rad/s]

"""
Explanation: Description
The following information is given about the simple rotating loop shown in Figure 7-6:
<img src="figs/FigC_7-6.jpg" width="70%">
\begin{equation}
\begin{array}{ll}
B = 0.4\,T  &    V_B = 48\,V \
l = 0.5\,m  &      R = 0.4\,\Omega \
r = 0.25\,m & \omega = 500\,rad/s
\end{array}
\end{equation}
End of explanation
"""


e_ind = 2*r*l*B*w
print('e_ind = {:.0f} V'.format(e_ind))

"""
Explanation: (a)

Is this machine operating as a motor or a generator? Explain.

(b)

What is the current i flowing into or out of the machine? 
What is the power flowing into or out of the machine?

(c)
If the speed of the rotor were changed to 550 rad/s

What would happen to the current flow into or out of the machine?

(d)
If the speed of the rotor were changed to 450 rad/s

What would happen to the current flow into or out of the machine?

SOLUTION
(a)
If the speed of rotation $\omega$ of the shaft is 500 rad/s, then the voltage induced in the rotating loop will be:
$$e_\text{ind} = 2rlB\omega$$
End of explanation
"""


i = (e_ind - V_B) / R
print('''
i = {:.1f} A
========='''.format(i))

"""
Explanation: Since the external battery voltage is only 48 V, this machine is operating as a generator, charging the
battery.
(b)
The current flowing out of the machine is approximately:
$$i = \frac{e_\text{ind} - V_B}{R}$$
<hr>

Note that this value is the current flowing while the loop is under the pole faces. When the loop goes
beyond the pole faces, $e_\text{ind}$ will momentarily fall to 0 V, and the current flow will momentarily reverse.
Therefore, the average current flow over a complete cycle will be somewhat less than 5.0 A.
<hr>
End of explanation
"""


w_c = 550 # [rad/s]
e_ind_c = 2*r*l*B*w_c
e_ind_c

"""
Explanation: (c)
If the speed of the rotor were increased to 550 rad/s, the induced voltage of the loop would increase to:
End of explanation
"""


i_c = (e_ind_c - V_B) / R
print('''
i_c = {:.1f} A
============'''.format(i_c))

"""
Explanation: Volts and the current flow out of the machine will increase to
End of explanation
"""


w_d = 450 # [rad/s]
e_ind_d = 2*r*l*B*w_d
e_ind_d

"""
Explanation: (d)
If the speed of the rotor were decreased to 450 rad/s, the induced voltage of the loop would fall to:
End of explanation
"""


i_d = (V_B - e_ind_d) / R
print('''
i_d = {:.1f} A
==========='''.format(i_d))

"""
Explanation: Volts. Here, $e_\text{ind}$ is less than $V_B$ , so current flows into the loop and the machine is acting as a motor. The current
flow into the machine would be:
$$i = \frac{V_B - e_\text{ind}}{R}$$
End of explanation
"""


