GithubHelp home page GithubHelp logo

aalto-electric-drives / motulator Goto Github PK

View Code? Open in Web Editor NEW
123.0 13.0 50.0 60.09 MB

Motor Drive Simulator in Python

Home Page: https://aalto-electric-drives.github.io/motulator/

License: MIT License

Python 100.00%
python control-systems electric-drives electric-machines electrical-engineering power-electronics converters induction-motors inverters simulations

motulator's Introduction

motulator: Motor Drive Simulator in Python

DOI Build Status License PyPI version shields.io All Contributors

Introduction

This open-source software includes simulation models for an induction motor, a synchronous reluctance motor, and a permanent-magnet synchronous motor. The motor models are simulated in the continuous-time domain while the control algorithms run in discrete time. The default solver is the explicit Runge-Kutta method of order 5(4) from scipy.integrate.solve_ivp. Various control algorithms are provided as examples. The documentation is available here:

https://aalto-electric-drives.github.io/motulator/

Installation

This software can be installed using pip:

pip install motulator

Alternatively, the repository can be cloned:

https://aalto-electric-drives.github.io/motulator/installation.html

Usage

The drive system, controller, reference sequences etc. are easy to configure. As a starting point, example scripts and Jupyter notebooks can be downloaded here:

https://aalto-electric-drives.github.io/motulator/auto_examples/index.html

New system models and controllers can be developed using the existing ones as templates.

Contributing

If you'd like to help us develop motulator, please have a look at these guidelines first.

Contributors

Thanks go to these wonderful people:

Lauri Tiitinen
Lauri Tiitinen

πŸ’» πŸ€” πŸ’‘ πŸ§‘β€πŸ«
HannuHar
HannuHar

πŸ’» πŸ›
Marko Hinkkanen
Marko Hinkkanen

πŸ’» πŸ€” πŸ’‘
silundbe
silundbe

πŸ’» πŸ’‘
JoonaKukkonen
JoonaKukkonen

πŸ’» πŸš‡
jarno-k
jarno-k

πŸ€”
angelicaiaderosa
angelicaiaderosa

πŸ’» πŸ’‘
Luca Peretti
Luca Peretti

πŸ€” πŸ“£
GianmarioPellegrinoPolito
GianmarioPellegrinoPolito

πŸ”£
Simone Ferrari
Simone Ferrari

πŸ”£
Jialed0303
Jialed0303

πŸ€”
murgui
murgui

πŸ›
Nithin Valiyaveettil Sadanandan
Nithin Valiyaveettil Sadanandan

πŸ›
saarela
saarela

πŸ›
Ushnish
Ushnish

πŸ›
Francesco-Lelli
Francesco-Lelli

πŸ’» πŸ’‘ πŸ€”

This project follows the all-contributors specification. Contributions of any kind welcome!

Acknowledgement

This project has been sponsored by ABB Oy and by the Research Council of Finland Centre of Excellence in High-Speed Electromechanical Energy Conversion Systems. The example control methods included in this repository are based on published algorithms (available in textbooks and scientific articles). They do not present any proprietary control software.

motulator's People

Contributors

allcontributors[bot] avatar angelicaiaderosa avatar francesco-lelli avatar hannuhar avatar joonakukkonen avatar lauritapio avatar mhinkkan avatar saarela avatar silundbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

motulator's Issues

Modulation for Inverters

This issue aims to develop functionality for the inverter part of ’Motulator’, including a two-level and three-level inverter with the Space Vector Modulation (SVPWM) and over-modulation mode. In addition, to solve unbalanced neutral point voltage problems for the three-level inverter and establish a harmonic analyzer based on a non-uniformed Fourier transform.

Suggested example does not run on version 0.1.2

Hi,

I just wanted to let you know that I had trouble running the example from the repository landing page in Motulator 0.1.2. The issue does not happen with version 0.1.0, which runs the example properly.

In version 0.1.2, the error is:

File "LocalPath\Motulator\hellowWorld.py", line 16, in <module> File "PythonPath\motulator\plots.py", line 76, in plot ax2.plot(mdl.t, mdl.tau_L/base.tau, '--') File "PythonPath\matplotlib\axes\_axes.py", line 1635, in plot lines = [*self._get_lines(*args, data=data, **kwargs)] File "PythonPath\matplotlib\axes\_base.py", line 312, in __call__ yield from self._plot_args(this, kwargs) File "PythonPath\matplotlib\axes\_base.py", line 498, in _plot_args raise ValueError(f"x and y must have same first dimension, but " ValueError: x and y must have same first dimension, but have shapes (8027,) and (1,)

Thanks for this nice project.

mt.BaseValues() examples and documentation don't match expected value in 0.1.2

Hi,

I'm using v0.1.2, I tried running 'plot_vector_ctrl_pmsm_2kw.py' and it reports the error

Traceback (most recent call last):
    base = mt.BaseValues(
TypeError: BaseValues.__init__() got an unexpected keyword argument 'n_p'

I checked the reference at https://aalto-electric-drives.github.io/motulator/autoapi/motulator/index.html#motulator.BaseValues and indeed the example used the suggested arguments.

I removed the argument and then the error was that it was missing argument 'p', so it looks like n_p has been renamed to p, so either the examples should be changed to p or the function should be changed to n_p.

Regards

Unit question

First of all, thanks for the great work on this project!

I've been trying to line up simulation results, and I've been getting unexpected scaling errors on torque and speed. I think I've tracked it down to the flux calculations here:

Parameters
----------
psi_s : complex
Stator flux linkage (Vs).

tau_M = 1.5*self.n_p*np.imag(i_s*np.conj(psi_s))

dpsi_s = u_s - self.R_s*i_s - 1j*self.n_p*w_M*psi_s

I believe these calculations (torque and back-emf) are assuming a flux linkage in units of webers, whereas the comment gives units of Vs. If I adjust the flux number by the difference (2*pi) I get results that look roughly consistent for torque and speed (might be off by a small scale factor).

For example, say I have a motor rated at 200 rpm/V (line-to-line) and 1 pole-pair. I calculate a flux in Vs of psi_f = 60. / (sqrt(3) * 200 * n_p) = 0.173Vs. When I simulate with that flux value I see speeds (w_M, mechanical) of ~21 rad/s or 200RPM at voltages of ~5.5V (calculated by multiplying mdl.data.q by the bus voltage). If instead I use psi_f = 0.028 Wb I see speeds of w_M = ~1130RPM at ~5V, which is more consistent with the 200 rpm/V motor constant.

Thanks!

Latex issues in running

Hi,

I cloned the repo, figured out it needs numpy, scipy and matplotlib to run. So, installed them and tried running simulate_sensored.py . I get issues with latex. Initially I got "RuntimeError: Failed to process string with tex because latex could not be found". I then installed latex support with sudo apt install texlive-latex-base . I am using ubuntu 18.04. I still see issues like "RuntimeError: latex was not able to process the following string: b'lp'". Could you please advice the right method to add latex support? Thanks.

Also, am attaching a .gitignore file and a requirements.txt file which would be good to add to the rep
gitignore.txt
requirements.txt
o.

Looking to simulate BLDC and FOC

Hi guys, this is super cool! Thanks for all the hard work to make this project. I'm looking to simulate the following motor
https://store.cubemars.com/goods-859-RI100+KV105.html and a simple velocity + current controller like >
image

Before I dive deeper on the control side does the following setup seem okay for the motor?

import numpy as np
import motulator as mt
import math

motor = mt.SynchronousMotor()
mech = mt.Mechanics()
conv = mt.Inverter(u_dc=48)
mdl = mt.SynchronousMotorDrive(motor, mech, conv)

pars = mt.SynchronousMotorVectorCtrlPars(sensorless=False)
pars.n_p = 14 # Pole pairs
pars.L_d = 366.7e-6 # Inductance
pars.L_q = 366.7e-6 # Inductance
pars.R_s = 126e-3   # Stator resistance

pars.psi_f = 60 / (math.sqrt(3) * math.pi * 0.0109 * pars.n_p) # Flux linkage from KT 
pars.J = 215e-6 # Rotor inertia
pars.i_s_max = 1.5*math.sqrt(2) * 5 # 5A max ? 

ctrl = mt.SynchronousMotorVectorCtrl(pars)

## speed controller parameters
speed_kp = 10
speed_ki = 0.1
speed_kt = 1

ctrl.speed_ctrl.k_p = speed_kp
ctrl.speed_ctrl.k_t = speed_kt
ctrl.speed_ctrl.alpha = speed_ki/speed_kt


## Define and run simulation ##
# Speed reference
times = np.array([0, .125, .25, .375, .5, .625, .75, .875, 1])*4
values = np.array([0, 0, 1, 1, 0, -1, -1, 0, 0])
ctrl.w_m_ref = mt.Sequence(times, values)

# External load torque
times = np.array([0, .125, .125, .875, .875, 1])*4
values = np.array([0, 0, 0, 0, 0, 0])
mdl.mech.tau_L_t = mt.Sequence(times, values)

sim = mt.Simulation(mdl, ctrl, pwm=False)
sim.simulate(t_stop=4)
mt.plot(sim)

Trying to use the function plot_extra()

Hello, I am trying to use the function which I see on your documentation. See below.

sphinx_gallery_thumbnail_number = 2

plot(sim, base)
plot_extra(sim, t_span=(1.1, 1.125), base=base)

What I did is to copy this function into one of the existing examples (2.2kW PMSM) which didntΒ΄ have it. For some reason, that function is not found. Could you please give me some guidance on how to use this function?

Kind regards,
Jaime

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.