Skip to content

Commit

Permalink
Python scripts available! Fixed #5 then
Browse files Browse the repository at this point in the history
I've added the Python scripts which replicate the same computations made in Matlab/Octave.
  • Loading branch information
gbacco5 committed Apr 7, 2018
1 parent a00cf84 commit f802cc7
Show file tree
Hide file tree
Showing 6 changed files with 444 additions and 11 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Synchronous Reluctance Rotor with *fluid* flux-barriers.

## Requirements

Matlab or Octave to compute the points.
Matlab or Octave or Python (NumPy + SciPy) to compute the points.
The points calculation is general, so it could be implemented in any
language, but I chose Matlab/Octave because it is my standard
interface with [FEMM](http://www.femm.info) software.
Expand All @@ -29,10 +29,3 @@ make a porting for your CAD engine or FEA software.
If you do so, consider contributing to the project adding your
interface scripting.



## ETA

Already shipped! The documentation is not ready, though.

~~Weeks or months, starting March 2018.~~
Binary file modified doc/doc.pdf
Binary file not shown.
24 changes: 21 additions & 3 deletions doc/doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ \section*{Goal}


\section*{Requirements}
Matlab or Octave to compute the points. The points calculation is general, so
it could be implemented in any language, but I chose Matlab/Octave because it
is my standard interface with \href{http://www.femm.info/}{FEMM} software.
Matlab or Octave or Python (NumPy + SciPy) to compute the points.
The points calculation is general, so it could be implemented in any language,
but I chose Matlab/Octave because it is my standard interface with
\href{http://www.femm.info/}{FEMM} software.

If you do not use FEMM, you can still use the calculation part and make a
porting for your CAD engine or FEA software. If you do so, consider
Expand Down Expand Up @@ -181,6 +182,23 @@ \section{Examples}
\includegraphics[width=0.75\linewidth]{ex3}


\section{Files needed}

For Matlab/Octave, the files needed for the computation are

\texttt{fluid.m} and

\texttt{calc\_fluid\_barrier.m}

\noindent
while for Python they are

\texttt{fluid.py} and

\texttt{fluid\_functions.py}.



\clearpage
\section{Theory}

Expand Down
47 changes: 47 additions & 0 deletions fluid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 5 21:31:31 2018
@author: Giacomo
"""

from fluid_functions import *

deb = 0;

## DATA
rotor = structtype();
rotor.p = 2; # number of pole pairs
mm = 1e-3; # millimeters
rotor.De = 200*mm; # [m], rotor outer diameter

rotor.Nb = 3; # number of flux-barriers
rotor.tb = np.array([4, 8, 15])*mm; # flux-barrier widths
rotor.wc = np.array([3, 7, 12, 10])*mm; # flux-carrier widths
rotor.Nstep = np.array([2, 4, 6]); # number of steps to draw the flux-barrier side
rotor.wrib_t = 1*mm; # [m], tangential iron rib width

# you can input flux-barrier angles or let the program compute them
#rotor.barrier_angles_el = np.array([14,26,38])*2; # [deg], electrical flux-barrier angles
#rotor.barrier_end = 'rect'; # choose 'rect' or comment

# you can define the rib width or comment
rotor.wrib = np.array([1,2,4])*mm; # [m], radial iron rib widths
# You can define the magnet width or comment
#rotor.wm = np.array([10,20,40])*mm;


## barrier points computation
barrier = structtype();
barrier = calc_fluid_barrier(rotor, deb);



## simple matlab plot
for bkk in range(0,np.size(barrier.X)):
plt.plot(np.squeeze(barrier.X[bkk]), np.squeeze(barrier.Y[bkk]), '.-')

plt.axis('equal')
plt.show()


Loading

0 comments on commit f802cc7

Please sign in to comment.