Skip to main content

An advanced PID controller

Project description

moat-lib-pid

% start main % start synopsis

An advanced PID controller in Python. It does not require a fixed feed rate, supports anti-windup, and contains an optional first-order filter for the derivative term.

% end synopsis

This module was vendorized from the advanced-pid module by Erkan Adali erkanadali91@gmail.com.

MoaT improvements include

  • a CPID subclass with a settable reference
  • saving internal state, for crash recovery and rebooting
  • introspection

Usage

Usage is very simple:

from moat.lib.pid import PID

# Create PID controller
pid = PID(Kp=2.0, Ki=0.1, Kd=1.0, Tf=0.05)

# Control loop

reference = 1.0

while True:
    # Get current measurement from system
    timestamp, measurement = system.get_measurement()

    # Calculate control signal by using PID controller
    control = pid(reference - measurement, t=timestamp)

    # Feed control signal to system
    system.set_input(control)

The package's examples includes a toy mass-spring-damper system model for testing.

% end main

License

Licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moat_lib_pid-0.8.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moat_lib_pid-0.8.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file moat_lib_pid-0.8.2.tar.gz.

File metadata

  • Download URL: moat_lib_pid-0.8.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for moat_lib_pid-0.8.2.tar.gz
Algorithm Hash digest
SHA256 603eaddcff68b1bde83fc1cf5834319ffe6b770023f1be37d220fbb2cedaadf1
MD5 4b1cdc4c4879ce4abcddd9a31c3d2cab
BLAKE2b-256 5b1b9437880e54598128acc10a3c13e85d132f0bc79daae7741246f033f740ac

See more details on using hashes here.

File details

Details for the file moat_lib_pid-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: moat_lib_pid-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for moat_lib_pid-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88703276614427253788ecad4367b1375a1e87baefe2b49654bb1c582b421791
MD5 7b9c52274a45a2be705e7ce5a37b93e4
BLAKE2b-256 0c906ce635891cdd655d546299f284065ea934c8a409075fdaccb23a5c348e5a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page