A package for electric machinery analysis.
Project description
emachinery
A package for analysis of electric machinery.
Instructions to use emy-c
[A]. Install
To run the source code, git clone the repo and create a virtual environment via conda:
conda create --name emy python=3.10 streamlit numpy pandas control matplotlib numba openpyxl psutil pyyaml
The package further requires the following free softwares to compile c source codes:
- gcc (comes with Minimalist GNU for Windows---See this awesome page for info)
- gmake.exe (I use the one from TI's CCS, it is located at somewhere like:
D:\ti\ccs930\ccs\utils\bin\gmake.exe
. Anyway, I decided to just copy-paste gmake.exe to/emachinery/acmsimc/c/gmake.exe
. So no need to install CCS anymore.)- It also works with CMake with some minor modification.
Alternatively, the package can be installed via pip.
pip install emachinery
emy
Command emy
is an entry point for starting the main program of this package, which is equivalent to python emachinery/main.py
[B]. Functions (outdated)
1. Machine Quantities Calculations & Conversion
2. PI Regulator Tuner based on Texas Instruments' InstaSPIN
3. Run C-based Numerical Integration Simulation
4. Sweep Frequency Analysis
5. Run Python- and Numba-based Realtime Numerical Integration Simulation
6. FEA based Machine Design and Multi-Objective Optimization (develop)
7. PC User GUI for Serial Communication to DSP (develop)
[C]. Simulation Tips
- Field oriented control is an asymptotic input-output linearizing (IOL) control. This means the IOL is achieved only when flux modulus is regulated to its reference. So before motor starts, we must wait for the motor to build up its magnetic air gap field or else the starting transient would be disturbed. Refer to the figure below.
- The inductance of the motor matters. For a small "DC" servo PM motor, the inductance is relatively designed to be low because the DC source is usually only 24 V or 48 V. However, an induction motor usually has higher inductance, which limits the bandwidth of the current loop, I think. For example, this is what happens to d-axis current regulation when I set desired velocity loop bandwidth from 50 Hz up to 100 Hz. Refer to the figure below.
[D]. Known Issues (outdated)
GNU Make failed to create process
After adding installing CCS and MinGW, you might need to restart the PC.
gcc -o main pmsm_comm.c im_controller.c ... -I. -L.
process_begin: CreateProcess(NULL, gcc -o main pmsm_comm.c im_controller.c... -I. -L., ...) failed.
make (e=2): The system cannot find the file specified.
makefile:11: recipe for target 'main' failed
gmake: *** [main] Error 2
See this question
[E] Other Information
This package is published to PYPI following https://www.youtube.com/watch?v=Qs91v2Tofys
Changelog
2.0.0
- Streamlit now serves as the GUI.
- Support both acmsimcv5 (c based simulation) and ACMSimPy (python/numba based simulation).
1.3.2
- ACMSimPy: memorize user's last input
- ACMSimPy: allow user to do basic operations with the available variables and show in scope.
1.3.1
- Attempt to distribute <gmake.exe> with the package.
1.3.0
- Add button for revoking console (for Python based real-time simulation).
- New gui-v3 using Wanderson's has issues with matplotlib stylesheet (which cannot be resolved and new gui is postponed).
- Sensorless operation with ACMSimPy is tested.
1.2.6
- Use pycairo for faster plotting (as backend for matplotlib).
1.2.5
- Python based Real-time simulation now supports more waveforms.
1.2.4
- Python packaging issue. Update Manifest.in. See this post.
1.2.3
- Fix bugs when calling acmsimpy from app_functions.py.
1.2.2
- Fix bugs when setting the path to acmsimc.
1.2.0
- Mordern GUI in dark theme by Wanderson.
- Top level global variable CTRL, which is a struct of pointers to other structs.
1.1.5
- Recover last user selected MachineName and MachineType.
1.1.4
- Anaconda3 (Python 3.8) comes with qtconsole now, but it will cause problems.
My code was developed with Anaconda3 (Python 3.7). So one silly fix is to revert back to Python 3.7 for now:
conda install python=3.7 anaconda=custom
But before you try to revert, trypip install --upgrade jupyterlab
first.
1.1.3
- No use of LoadUi when published.
1.1.2
- Support parametric analysis.
1.1.1
- User is now able to select from different plot settings.
- Support sinusoidal flux modulus command for induction motor.
- Remember user's last selected plot setting considering machine types, i.e., IM or PMSM.
- Marino05 is tuned.
1.1.0
- Induction motor simulation.
- Marino05 is added.
- Harnefors06 is tuned for a different motor.
- Fix the bug "cannot file .dat file" when "Plot Here" is clicked upon start.
1.0.9
- (Video@Bilibili) Demonstrate the effectiveness of the current loop decoupling (PMSM).
- Allow velocity-open-loop and current-closed-loop for sweep frequency analysis.
- Automatically add path2acmsimc if the user-specified path does not exist.
- Remember last user input for C-based simulation.
1.0.8
- I was stupid. Version 1.0.7 did not do its job.
1.0.7
- Add the resource "makefile" to the package.
1.0.6
- Remember last user input for path2acmsimcv5 and add config.json to gui/
- Publish acmsimcv5 along with the package.
1.0.5
- Add sweep-frequency and bode-plot feature.
- gmake compile .c program, execute .exe, collect .dat, and ggplot.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file emachinery-2.0.1.tar.gz
.
File metadata
- Download URL: emachinery-2.0.1.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff5589242b967df84911f0c57450ccc7323e6d857a5c226951036fb14e37d5a3 |
|
MD5 | 79e9c16893eb0a0bedb04c9492a29fb8 |
|
BLAKE2b-256 | f8713cfe6e7267157cc093e282b4feacf06f7a7b528b1f9c0f930eb34f764760 |
File details
Details for the file emachinery-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: emachinery-2.0.1-py3-none-any.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e92d6862968e4da36280ad9d8c6efd8f4a52b89ac0360bb0f17fff4271bac07b |
|
MD5 | eeca9058acf6e3f712494cf607397e0f |
|
BLAKE2b-256 | 443befc49f6d2c0d6cbf8e80a65a8870f69fb5bfb15f79cfedd074bd84fef9cb |