Skip to main content

PyEMMO is a interface for modeling electrical machines in the open-source FEA software Onelab

Project description

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

Currently you will need to install PyEMMO from this Github repository. Use the package manager pip to install PyEMMO.

pip install https://github.com/ttz-emo/pyemmo.git

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyemmo-1.6.0.tar.gz (707.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyemmo-1.6.0-py3-none-any.whl (939.6 kB view details)

Uploaded Python 3

File details

Details for the file pyemmo-1.6.0.tar.gz.

File metadata

  • Download URL: pyemmo-1.6.0.tar.gz
  • Upload date:
  • Size: 707.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pyemmo-1.6.0.tar.gz
Algorithm Hash digest
SHA256 597cba7c62714463bae9981406c358fd0b000ef70f3813ea5ff7d45be85d9428
MD5 006f87d010f0056b9211b3155eee1931
BLAKE2b-256 182429c46199b9332c546001ac19b1f0b64bc8d2874999a96c0e07340eef2cac

See more details on using hashes here.

File details

Details for the file pyemmo-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: pyemmo-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 939.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pyemmo-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ff1eb04e30ea864e369ec2517c58e59bcb11e9087b0be37897a543233968ba3
MD5 620ff45195921a4a7535c83703dedc19
BLAKE2b-256 98824c193ed6cf81096b411def0687009770a1c85f28b8dc9cb7b569e3875e4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page