Skip to main content

motulator-impedance

Mechanical impedance of machine drives and output admittance of grid converters for motulator

PyPI version

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

This package measures small-signal frequency responses of systems built in motulator by frequency sweeps: the system is simulated to its operating point, a small-signal excitation is injected one frequency at a time, and the response is computed with the discrete Fourier transform. The frequencies are simulated in parallel. Two responses are provided:

  • Mechanical impedance ZM(s) = −ΔτM(s)/ΔωM(s) of a machine drive, which describes the dynamics of the machine and its control system as seen from the shaft [1]. The rotor speed is imposed, and speed excitations are superimposed on it. A drive whose mechanical impedance is passive (its phase within ±90°) is stable with any passive mechanical system.
  • Output admittance of a grid converter at the point of common coupling [2], as a 2×2 matrix in synchronous coordinates. The PCC voltage is imposed by a stiff source, and voltage excitations are injected in the d- and q-axes. The admittance is the basis of impedance-based stability analysis, e.g., through its passivity index.

Installation

Install the package from PyPI (motulator is installed as a dependency):

pip install motulator-impedance

The package supports motulator 0.15, and the support is extended after each new release of motulator has been tested. For development, clone the repository and install the package with pip install -e .[dev].

Usage

The system model and the control system are built in motulator as usual. The mechanical impedance of a drive, whose rotor speed is imposed by ExternalRotorSpeed:

import motulator.drive.control.im as control
import numpy as np
from motulator.drive import model

from motulator_impedance import drive

par = model.InductionMachineInvGammaPars(
    n_p=2, R_s=60e-3, R_R=30e-3, L_sgm=2.2e-3, L_M=24.5e-3
)
mechanics = model.ExternalRotorSpeed()
mechanics.set_external_rotor_speed(40.0)  # Operating-point speed (rad/s)
mdl = model.Drive(
    model.InductionMachine(par), mechanics, model.VoltageSourceConverter(u_dc=540)
)
cfg = control.ObserverBasedVHzControllerCfg(psi_s_nom=1.04, i_s_max=170.0)
ctrl = control.VHzControlSystem(control.ObserverBasedVHzController(par, cfg))
ctrl.set_speed_ref(40.0)

meas_cfg = drive.MeasurementCfg(abs_w_e=0.3, freqs=np.geomspace(1, 500, 50))
Z_M = drive.measure_mechanical_impedance(mdl, ctrl, meas_cfg)
drive.plot_mechanical_impedance(Z_M)

The output admittance of a grid converter:

from motulator.grid import control, model

from motulator_impedance import grid

mdl = model.GridConverterSystem(
    model.VoltageSourceConverter(u_dc=650),
    model.LFilter(L_f=5e-3),
    model.ThreePhaseSource(w_g=2 * np.pi * 50, e_g=326.6),
)
cfg = control.CurrentVectorControllerCfg(i_max=30.0, L=5e-3, T_s=1 / 10e3)
ctrl = control.GridConverterControlSystem(control.CurrentVectorController(cfg))
ctrl.set_power_ref(5e3)
ctrl.set_reactive_power_ref(0.0)

meas_cfg = grid.MeasurementCfg(abs_u_e=3.0, freqs=np.geomspace(1, 10e3, 100))
Y = grid.measure_output_admittance(mdl, ctrl, meas_cfg)
grid.plot_output_admittance(Y, form="re_im")

The results are dataclasses, which can be saved, e.g., by scipy.io.savemat(path, dataclasses.asdict(Y)). Complete examples are in the example gallery.

Scope

  • The frequencies are simulated in parallel processes by default (multiprocess=True), so the model and the control system must be picklable: use module-level functions or callable objects as references, not lambda functions.
  • With carrier-comparison PWM, background switching harmonics can bias the measured admittance near the switching harmonics and their sidebands.
  • The grid impedance and the DC bus of the system model are included in the operating point; the admittance is measured with the PCC voltage imposed.

References

  1. Hartikainen, Tiitinen, Laine, Hinkkanen, "Identification of mechanical impedance of an electric machine drive for drivetrain design," Proc. IEEE IEMDC, 2023, https://doi.org/10.1109/IEMDC55163.2023.10238992
  2. Määttä, Kukkola, Seppänen, Hinkkanen, "Open-source Python tool for grid converter output admittance identification," 2026, https://arxiv.org/abs/2607.10653

License

MIT

Metadata

Release files for motulator-impedance 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for motulator-impedance 0.1.0
File Size Uploaded Provenance
motulator_impedance-0.1.0.tar.gz 24.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for motulator-impedance 0.1.0
File Interpreter ABI Platform
motulator_impedance-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.9 kB

Release files / motulator_impedance-0.1.0.tar.gz

Download URL motulator_impedance-0.1.0.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b7b2f45b11ba1c114602eed6e7a28d97bd05a3370eca6208a29003bb610d964a
BLAKE2b-256 checksum
How to use checksums
06af170e713a9f3ef549426104aa1d7bb0fdab20f381566da36bc804082f4c76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / motulator_impedance-0.1.0-py3-none-any.whl

Download URL motulator_impedance-0.1.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16dcee0cd77a158b07e4fec0cceec4a6fa0f7c1cb048d00e3fbfeae0537c2a15
BLAKE2b-256 checksum
How to use checksums
b6d4541d57ac767e40987bf0e9d45c5ad3d4e384dbfc5256211c7dc0cbbfc6f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for motulator-impedance 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page