❯ python .\main.py
Validate: 0.02486440087288949 = 0.024864400872889467 ?
Kp_omg=30, Ki_omg=0.08943749999999999
Kp_cur=20, Ki_cur=0.005
Simulation Run Time=15.0 s
Simulation Costs Time=4.840036630630493 s
This project aims to simulate AC induction motor in Python.
-
Forked from https://github.com/horychen/ACMSIMC_TUT
-
Thanks to Jiahao Chen | 陈嘉豪
-
GPL-3.0 licensed
-
Code structure
- Main Loop
- Main : Simulation Main Loop
- ACM : AC Induction Motor Class
- CTRL : Controller Class
- Observer : Observer Class
- Utils : All Utils imports and constants
- FileIO : File Input and Output class
- Macros : All lambda functions
- ACMPlot : Draw Treand plot
- ACMPlot2 : Draw Trend plot in Plotly
- Addition Files
- B-H_Cruve : Draw B-H curve from 33.txt
- LZ4-example : Test LZ4 and Zstandard performance
- ResultPrint : Print result table in tabulate
- rk4 : Runge-Kutta 4th ODE solver in C shared library
- Main Loop
-
6th-Derivative-Of-Position (for motion control)
- reference 1: Forward differnece calculation of bezier
- reference 2: Affordable Industrial Grade Motion Control https://github.com/synthetos/TinyG/wiki
- Smooth Jerk give a smooth motion control which usually used by elevator , servo controlllers , Robots ,.etc. (2nd Picture shown above)
-
Prerequisites
- Python V3.8.1
- Requirements
-
HOWTO
-
Open your powershell in windows
-
Change work path to a directory you like
-
Run code below line-by-line
mkdir ACMSIM cd ACMSIM git clone https://github.com/tinyko/_TINY_ACMSIMC.git . ./make.ps1 python main.py
-
Wait for seconds until algorithm.dat and info.dat file are generated
-
Then matplotlib.pyplot is shown figures
-
- Visualized Configuration of AC Induction Motor
- Stator and rotor Laminations Design
- Coil Winding Calculations
- Skewed Rotor bar
- Materials Difference
- Losses
- Mechanical Losses
- Iron Losses
- Copper Losses
- Wind friction Losses
- Deep bar effects , Skin effect and the Eddy currents
- GUI in PyQT5 with Trend Viewer , Plots Evaluating ,.etc
- Full No Load Test and More Detailed Motor Model
- Control Schemes
- V/F Scalar Control
- Vector Control
- DTC(Direct Torque Control)
- DSC(Direct Self-control)
- SVM(Space Vector Modulation)
- FOC(Field Oriented Cowntrol)
- Direct FOC
- Indirect FOC
- DTC(Direct Torque Control)
- Sensorless Control
- Magnetic-field Weakening
- (Un)Coiler tension control
- Two-mass drives issue
- Ramp
- Linear Reference
- S-curve
6th-Derivative-of-Position
- Stable And Transient Motor Model Analysis
- AC-AC(DC-AC) converter Topology
- Converter with DC-link
- (regenerative) voltage-source
- current-source
- Matrix Converter
- the Direct Matrix
- the indirect matrix
- Hybrid Matrix
- Converter with DC-link
TO DO List
Separate Programm Functions into different python modules- GUI in PyQT5 (
Auto Scale GUI, QT GUI layout) / PySimpleGui - Async communications between Real-time and GUI module
- Design a python to c source translator(like simulink) (further plan)
motor topology- Add json config file to manage parameters
- create a Trend Viewer to evaluate trends data , which could have some functions to calculate,zoom in/out,.etc(like IBA©analyzer)
- Save all critical data in trends
- Create
a speicalHDF5 data file structure to contain data informations(timebase,timestamp,.etc) and values(bool,string,int,float,.etc) - Remove all redundant code and cross-reference
- Separate ODE-solver to a single module , Current Method is Runge-Kutta 4th order Method
- Methods
- Implicit(Explicit) Runge-Kutta Methods
- Adams–Bashforth methods
- Adams–Moulton methods
- Gear's Backward differentiation formulas (BDF)
- Euler Forawrd/Backward Method
- Kaps-Rentrop Methods / Rosenbrock methods
- Gauss-Jackson Method
- Predictor-Corrector Methods
- Relaxation Methods
- Issues
- Stiff problems
- Stability and convergence
- Methods
Decoupling sub-modulescProfile found out some slow code in main loop in cProfile.ps1 file:
cprofilev -f .\log.txt
Done List
Converted C program into Python Single File "Alter"Modified ACMPlot as a library to Main Python ScriptCompared LZ4 and Zstandard (Winner is LZ4! In Realtime scenanio)numpy ndarray could be converted into bytes , vice versaAdd a 6th-order speed ref curveAdd _slot_ to Class object
2020-02-16 Python 3.8.1 TotalTime:22.796 seconds
2020-02-21 Python 3.8.1 TotalTime:18.026 seconds
2020-03-05 Python 3.8.1 TotalTime:6.308 seconds