Excercises Electric Machinery Fundamentals

Chapter 6

Animation: Determining the rotor-slip with a compass


In [1]:
from sympy import init_session
init_session()
%matplotlib inline


IPython console for SymPy 1.0 (Python 3.5.2-64-bit) (ground types: python)

These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)
>>> init_printing()

Documentation can be found at http://docs.sympy.org/1.0/

Look at a superposition of two sinusoidal signals:


In [2]:
f=sin(x)*sin(y)
f


Out[2]:
$$\sin{\left (x \right )} \sin{\left (y \right )}$$

This product can be rewritten as a sum using trigonometric equalities. SymPy has a special function for those:


In [3]:
from sympy.simplify.fu import *
g=TR8(f)     # TR8 is a trigonometric expression function from Fu paper
Eq(f, g)


Out[3]:
$$\sin{\left (x \right )} \sin{\left (y \right )} = \frac{1}{2} \cos{\left (x - y \right )} - \frac{1}{2} \cos{\left (x + y \right )}$$

Now let us take an example with two different angular frequencies:


In [4]:
s = 0.03        # slip
fs = 50         # stator frequency in Hz
fr = (1-s)*fs   # rotor frequency in Hz
fr


Out[4]:
$$48.5$$

In [5]:
alpha=2*pi*fs*t
beta=2*pi*fr*t

Now plot the product of both frequencies:


In [6]:
# Create the plot of the stator rotation frequency in blue:
p1=plot(sin(alpha), (t, 0, 1), show=False, line_color='b', adaptive=False, nb_of_points=5000)
# Create the plot of the rotor rotation frequency in green:
p2=plot(0.5*sin(beta), (t, 0, 1), show=False, line_color='g', adaptive=False, nb_of_points=5000)
# Create the plot of the combined flux in red:
p3=plot(0.5*f.subs([(x, alpha), (y, beta)]), (t, 0, 1), 
            show=False, line_color='r', adaptive=False, nb_of_points=5000)
# Make the second and third one a part of the first one.
p1.extend(p2)
p1.extend(p3)
# Display the modified plot object.
p1.show()