# Excercises Electric Machinery Fundamentals
## Chapter 6

## Animation: Determining the rotor-slip with  a compass


```python
from sympy import init_session
init_session()
%matplotlib notebook
```

    IPython console for SymPy 1.8 (Python 3.8.10-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 https://docs.sympy.org/1.8/
    
    Warning: Cannot change to a different GUI toolkit: notebook. Using qt instead.


Look at a superposition of two sinusoidal signals:


```python
f=sin(x)*sin(y)
f
```

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


```python
from sympy.simplify.fu import *
g=TR8(f)     # TR8 is a trigonometric expression function from Fu paper
Eq(f, g)
```

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


```python
s = 0.03        # slip
fs = 50         # stator frequency in Hz
fr = (1-s)*fs   # rotor frequency in Hz
fr
```


```python
alpha=2*pi*fs*t
beta=2*pi*fr*t
```

Now plot the product of both frequencies:


```python
# 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()
```

d6f19e87679bfadd8f6ae8032d4c886e0372b305
ipynb
Jupyter Notebook
Chapman/Ch6-Animation_RotorSlipMeasurementWithCompass.ipynb
dietmarw/EK5312
33b31d953f782043db0264116881060c9f059731
Unlicense
2017-07-16T22:28:25.000Z
2021-11-08T05:45:58.000Z
Chapman/Ch6-Animation_RotorSlipMeasurementWithCompass.ipynb
dietmarw/EK5312
33b31d953f782043db0264116881060c9f059731
Unlicense
Chapman/Ch6-Animation_RotorSlipMeasurementWithCompass.ipynb
dietmarw/EK5312
33b31d953f782043db0264116881060c9f059731
Unlicense
2018-01-17T15:01:33.000Z
2021-07-02T19:57:22.000Z
Qwen/Qwen-72B
1. YES
2. YES