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.6.6.tar.gz (8.3 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.6.6-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moat_lib_pid-0.6.6.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for moat_lib_pid-0.6.6.tar.gz
Algorithm Hash digest
SHA256 709a85a311441fbd02083d8fa073528d5d172d0bafc355956859847d699d9f47
MD5 5cadb9772fe543488f169497e7b09f43
BLAKE2b-256 a61700d744e9a4ade8148d9e59b1c2306d7cf44a9360a522becd4a89fafbc7e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moat_lib_pid-0.6.6-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for moat_lib_pid-0.6.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a524ec91b46b0d71bd7703ad77ce54427e1dba3755d53c20ec8addba78d338d7
MD5 20e639993fdfc1023b2c3502b4f4c59c
BLAKE2b-256 fc75521e7aa8e825a880d5a7fd77ec71d95d4a00732391ee49b6809f76c94187

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