# ---
# 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
# ---

# + [markdown] slideshow={"slide_type": "slide"}
# # Electric Machinery Fundamentals 5th edition
# ## Chapter 6 (Code examples)

# + [markdown] slideshow={"slide_type": "-"}
# ## Example 6-5 (d)
#
# **Creates a plot of the torque-speed curve of the induction motor as depicted in Figure 6-23.**

# + [markdown] slideshow={"slide_type": "skip"}
# **Note:** *You should first click on "`Cell` &rarr; `Run All`" in order that the plots get generated.*

# + [markdown] slideshow={"slide_type": "skip"}
# Import the PyLab namespace (provides set of useful commands and constants like Pi)

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


# + [markdown] slideshow={"slide_type": "slide"}
# First, initialize the values needed in this program.

# + slideshow={"slide_type": "fragment"}
r1 =  0.641                # Stator resistance
x1 =  1.106                # Stator reactance
r2 =  0.332                # Rotor resistance
x2 =  0.464                # Rotor reactance
xm = 26.3                  # Magnetization branch reactance
v_phase =  460 / sqrt(3)   # Phase voltage
n_sync  = 1800             # Synchronous speed (r/min)
w_sync  = n_sync * 2*pi/60 # Synchronous speed (rad/s)

# + [markdown] slideshow={"slide_type": "slide"}
# Calculate the Thevenin voltage and impedance from Equations 7-41a:
#
# $$ V_{TH} =  V_\phi \frac{X_M}{\sqrt{R_1^2 + (X_1 + X_M)^2}} $$
#
# and 7-43:
#
# $$ Z_{TH} = \frac{jX_m (R_1 + jX_1)}{R_1 + j(X_1 + X_M)} $$

# + slideshow={"slide_type": "fragment"}
v_th = v_phase * ( xm / sqrt(r1**2 + (x1 + xm)**2) )
z_th = ((1j*xm) * (r1 + 1j*x1)) / (r1 + 1j*(x1 + xm))
r_th = real(z_th)
x_th = imag(z_th)

# + [markdown] slideshow={"slide_type": "slide"}
# Now calculate the torque-speed characteristic for many slips between 0 and 1.

# + slideshow={"slide_type": "fragment"}
s = linspace(0, 1, 50) # Slip
s[0] = 0.001           # avoid divide-by-zero problems  
nm = (1 - s) * n_sync  # mechanical speed

# + [markdown] slideshow={"slide_type": "slide"}
# Calculate torque for original rotor resistance using:
#
# $$ \tau_\text{ind} = \frac{3 V_{TH}^2 R_2 / s}{\omega_\text{sync}[(R_{TH} + R_2/s)^2 + (X_{TH} + X_2)^2]} $$

# + slideshow={"slide_type": "fragment"}
t_ind1 = ((3 * v_th**2 * r2/s) /
          (w_sync * ((r_th + r2/s)**2 + (x_th + x2)**2)))

# + [markdown] slideshow={"slide_type": "fragment"}
# Calculate torque for doubled rotor resistance:
# -

t_ind2 = ((3 * v_th**2 * 2*r2/s) /
          (w_sync * ((r_th + 2*r2/s)**2 + (x_th + x2)**2)))

# + [markdown] slideshow={"slide_type": "slide"}
# Plot the torque-speed curve:

# + slideshow={"slide_type": "fragment"}
rc('text', usetex=True)   # enable LaTeX commands for plot
plot(nm, t_ind2,'k--',
     nm, t_ind1,'b',
     lw=2)
xlabel(r'$\mathbf{n_{m}}\ [rpm]$')
ylabel(r'$\mathbf{\tau_{ind}}\ [Nm]$')
title ('Induction motor torque-speed characteristic')
legend ((r'Doubled $R_{2}$','Original $R_{2}$'), loc = 3);
grid()

StarcoderdataJupyterScriptsDedupFiltered