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.0.tar.gz (8.7 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.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moat_lib_pid-0.8.0.tar.gz
  • Upload date:
  • Size: 8.7 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.8.0.tar.gz
Algorithm Hash digest
SHA256 46eb68e39009238495884e9461a7a1ed08f2750b480b9f3a3fb64a4148848c7b
MD5 897b1e2e5537838992a129244a84533b
BLAKE2b-256 bb9057cd718a239422b26b06da2ff9845b8c77abac9e47e4edca4d86cf852911

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moat_lib_pid-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9dd52f7b7f21b326d8be822bb55fc292e6266b7ebfce62b332c7ecbe9fa22039
MD5 41c4a05bf48af81648450423fdaecdf6
BLAKE2b-256 9f920173defe03728174b8c8b7ff796615492c387e59a9b5825169039f4fde03

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