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

Uploaded Python 3

File details

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

File metadata

  • Download URL: moat_lib_pid-0.6.7.tar.gz
  • Upload date:
  • Size: 8.4 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.7.tar.gz
Algorithm Hash digest
SHA256 0e44b17f1088fedb6163622bfb011cf0b6e364cc2dcca2ce5a1188e54207910c
MD5 6217159c678ff224c9bd6938d420cd31
BLAKE2b-256 235c008a4507afb5687880a4e5ebe993292f898a2a22c39d5db162a20e698a4f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moat_lib_pid-0.6.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 09c901e72b2faf59860c945f1ce1bcee97f3d464d31f99a6bd45914ab366a8f5
MD5 673220390c0dbd82c8eb365120916336
BLAKE2b-256 e63a51fa81f500494fc7b98d3870b6ff7dbf87a95e1b6db51546d7196def1dd8

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