This project is initially intended to adopt the PyOneDark Qt Modern GUI for visualization, but yesterday (2022-09-18) I found a better solutioin with DearPyGui.
The file main.py uses the PySide6 (or PyQt6), and the DearPyGui is simply a script /simulation/dem_demo.py.
-
- Install Anaconda 3 and open command prompt cmd.exe on Windows
-
conda create -n main python=3.10
-
conda activate main
-
pip install PySide6 matplotlib pandas numba qtconsole control dearpygui
-
cd /d D:\acmsimpy
-
python main.py
for PySide6 GUI orpython ./simulation/dem_demo.py
for DearPyGui. Or, you can simply run any core script in ./simulation folder, e.g.,python ./simulation/tutorials_ep6_maglev_motor.py
, batch-generating publication-ready figures with matplotlib.
To avoid PyQt plugin issues (with Anaconda Python 3.8), please go with Anaconda Python 3.10 as exemplified above.
What is shown in the screenshot below is a dual-rotor-topology axial-flux in-wheel motor driven by a three-phase voltage source inverter. Space-vector PWM with deadtime inserted and a 300 V DC bus are simulated. The motor is closed-loop controlled with speed/position feedback. The speed command is sinusoidals and aims to sweep through different frequencies to inspect dynamic speed control performance.
add later
- A unified ac motor model based on active flux concept by Ion Boldea is implemented. Thanks to this, all AC motors can be simulated as control target.
- Numerical simulation is done by Runge–Kutta method (RK4, ode4).
- Space-vector PWM is implemented according to TI ControlSUITE.
- User input logic separation from code and a modern GUI.
- Batch making technical-paper-ready figures. The code is the figure itself not the .pdf file!
- Real-time simulation as if you are debugging in CCS with an actual motor. You can change anything during the simulation in real-time. This is a feature that even Simulink does not provide.
- With DearPyGui (a python binding or wrapper for implot and imgui), GPU accelerated rendering plots is now possible, yay!