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

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.

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.1.tar.gz (716.0 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.1-py3-none-any.whl (948.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyemmo-1.6.1.tar.gz
  • Upload date:
  • Size: 716.0 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.1.tar.gz
Algorithm Hash digest
SHA256 676e2d1c6264cb85587d2bc1ffd4d0729cd5d938b0046bb0ee3766a5961faba3
MD5 b400dc00c08f36158355e95757504f4a
BLAKE2b-256 4749fa07db0dd25ceaa427bb4193ade7853c5075eec4a44dfde04a1268cf61e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyemmo-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 948.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 363011af581524f4461d15dca80736eb46e43e36f18977de03a2be8546773a16
MD5 ec4f22d0e31d51b04ce81e726819ca5b
BLAKE2b-256 671bbbaafd0f645510341d28b351b8919ceddfba80f6e94592840d99d2f12146

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