Skip to content

ttz-emo/pyemmo

Repository files navigation

PyEMMO

Python Electrical Machine Modelling in ONELAB

PyEMMO is a interface for modeling electrical machines in the open-source FEA software ONELAB. The goal of the project is to automate model creation and the simulation workflow for electrical machines with ONELAB.

Installation

Use the package manager pip to install PyEMMO.

pip install pyemmo

You will need versions of Gmsh and GetDP executables. While Gmsh can be directly installed from pip with the Gmsh Python-API, you will need to download GetDP individually.

Warning

Models created with PyEMMO fail with current GetDP version 3.6.0 due to mesh import error! You can check your GetDP version with getdp --version

Usage

The easiest way to start is by using the PYLEECAN project to create a electrical machine instance and feeding it into the PyEMMO-PYLEECAN interface.

Here is a small example of the PYLEECAN API:

from os.path import join

from pyemmo.api.pyleecan import main as pyleecan_api
from pyleecan.definitions import DATA_DIR
from pyleecan.Functions.load import load

# load a pyleecan machine
IPMSM_A = load(join(DATA_DIR, "Machine", "Toyota_Prius.json"))

# Run the main function of the pyleecan api:
pyemmo_script = pyleecan_api.main(
    pyleecan_machine=IPMSM_A,
    model_dir="./Toyota_Prius_ONELAB",  # path for the model files
    use_gui=True,  # select if you want to open the final model in Gmsh.
    gmsh="",  # optional gmsh executable.
    # If use_gui is True, pyemmo will try to find a Gmsh executable on your computer.
    getdp="",  # optional getdp executable. For simulation in the GUI.
)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Setup

After cloning the repository you should install pre-commit package using pip install pre-commit. After that please update the INSTALL_PYTHON path in the pre-commit hook under "./workingDirectory/pre-commit". Then run the following command to install the Git hooks:

./workingDirectory/install-hooks.sh

Or if you are on Windows:

install-hooks.bat

These hooks make sure you have formatted your files correctly.

🙏 Acknowledgements

License

GPLv3

Publications

Run Sphinx to create Documentation

To create or update the documentation you will need to do:

  1. Install the doc requirements with: pip install -r requirements-doc.txt.
  2. Make sure pyemmo is found by either creating a pyemmo.pth file in the site-packages folder or use pip install -e ..
  3. To fully build the documentation including the PYLEECAN api subpackage you need to install PYLEECAN. Currently we have to use the Github version since there is no new release yet: pip install git+https://gitlab.com/Eomys/pyleecan/tree/update-python-version.git
  4. Run Sphinx to build the docs e.g. in html doc\make.bat html.

You can run doc\make.bat plane to see the build options. Further information on building the documentation can be found in the Sphinx documentation.

About

Python Electrical Machine Modelling in ONELAB: PyEMMO is a interface for modeling electrical machines in the open-source FEA software ONELAB. The goal of the project is to automate model creation and the simulation workflow for electrical machines with ONELAB.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors