%pylab notebook
%precision 4
from scipy import constants as c   # we like to use some constants

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


N1 = 600
N2 = 200
i1 = 0.5           # A
i2 = 1.0           # A
mu_r = 1200
mu = mu_r * c.mu_0

"""
Explanation: Description
A two-legged core is shown in Figure P1-4 below:
<img src="figs/FigC_P1-4.jpg" width="70%">
The winding on the left leg of the core ($N_1$) has 600 turns,
and the winding on the right ($N_2$) has 200 turns. The coils are wound in the directions shown in the figure. 

If the dimensions are as shown, then what flux would be produced by currents $i_1 = 0.5\,A$ and $i_2 = 1.0\,A$?

Assume $\mu_r = 1200$ and constant.
End of explanation
"""


F_tot = N1 * i1 + N2 * i2 
print('F_tot =  {:.1f} At'.format(F_tot))

"""
Explanation: SOLUTION
The two coils on this core are wound so that their magnetomotive forces are additive, so the
total magnetomotive force on this core is
$$\mathcal{F}_\text{TOT} = N_1 i_1 + N_2 I_2$$
End of explanation
"""


l = 4 * (0.075 + 0.5 + 0.075)   # [m] core length on all 4 sides.
A = 0.15**2                     # [m²] 
R_tot = l / (mu * A)
print('R_tot =  {:.1f} kAt/Wb'.format(R_tot/1000))

"""
Explanation: The total reluctance in the core is $\mathcal{R}_\text{TOT} = \frac{l}{\mu_0 \mu_r A}$:
End of explanation
"""


phi = F_tot / R_tot
print('phi =  {:.3f} mWb'.format(phi*1000))

"""
Explanation: and the flux in the core is $\phi = \frac{\mathcal{F}\text{TOT}}{\mathcal{R}\text{TOT}}$:
End of explanation
"""


