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.1.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.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moat_lib_pid-0.8.1.tar.gz
  • Upload date:
  • Size: 9.1 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.1.tar.gz
Algorithm Hash digest
SHA256 1d65ea65c892f6c99914270b5746a2af1189af3495fab6f2929a800c9dc347ae
MD5 101a62b2f040cc65dd2444a2ac01e694
BLAKE2b-256 3fe81df3d1ebe633d3bd9a9c0da0b3502c66878291ca8d80fa5abdc36570fb51

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moat_lib_pid-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7fd24e6e03e6051731e8a6c04c3764092f01d75bf371f43b2328ea2091d882cf
MD5 592689a45c7b5703867e9e7d9c2f6033
BLAKE2b-256 a627bbe669a3ddb9e19a3d902627fca175a407bb856040cd89c8c0d148fa9f20

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