Catalog PyPI
Back to packageRELEASE DETAILS

0.0.8

PyPI

advanced-pid

[![Run Tests and Publish PyPI](https://github.com/eadali/advanced-pid/actions/workflows/main-branch.yml/badge.svg)](https://github.com/eadali/advanced-pid/actions/workflows/main-branch.yml) [![Documentation Status](https://readthedocs.org/projects/advanced-pid/badge/?version=latest)](https://advanced-pid.readthedocs.io/en/latest/?badge=latest) # advanced-pid An advanced PID controller in Python. The derivative term can also be used in practice thanks to built-in first-order filter. Detailed information can be found [here](https://en.wikipedia.org/wiki/PID_controller#Derivative_term). Usage is very simple: ```python from advanced_pid import PID # Create PID controller pid = PID(Kp=2.0, Ki=0.1

controlengineeringpidrealtheorytime
Published29 Jun 2022
Direct dependencies0
Transitive dependenciesNot calculated

README

Version 0.0.8 documentation

Run Tests and Publish PyPI Documentation Status

advanced-pid

An advanced PID controller in Python. The derivative term can also be used in practice thanks to built-in first-order filter. Detailed information can be found here.

Usage is very simple:

from advanced_pid import PID

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

# Control loop
while True:
    # Get current measurement from system
    timestamp, measurement = system.get_measurement()
    
    # Calculate control signal by using PID controller
    reference = 1.0
    control = pid(timestamp, reference - measurement)
    
    # Feed control signal to system
    system.set_input(control)

Complete API documentation can be found here.

Usage

Biggest advantage of advanced-pid, the derivative term has a built-in first-order filter.
advanced-pid package includes a toy mass-spring-damper system model for testing:

from advanced_pid import PID
from advanced_pid.models import MassSpringDamper
from matplotlib import pyplot as plt
from numpy import diff

# Create a mass-spring-damper system model
system = MassSpringDamper(mass=1.0, spring_const=1.0, damping_const=0.2)
system.set_initial_value(initial_position=1.0, initial_velocity=0.0)

# Create PID controller 
pid = PID(Kp=1.0, Ki=0.0, Kd=2.0, Tf=0.5)

# Control loop
time, meas, cont = [], [], []
for i in range(800):
    # Get current measurement from system
    timestamp, measurement = system.get_measurement()
    
    # Calculate control signal by using PID controller
    control = pid(timestamp, -measurement)
    
    # Feed control signal to system
    system.set_input(control)
    
    # Record for plotting
    time.append(timestamp)
    meas.append(measurement)
    cont.append(control)

# Plot result
fig, (ax1, ax2, ax3) = plt.subplots(3, 1)
fig.suptitle('Mass-Spring-Damper system')
ax1.set_ylabel('Measured Position [m]')
ax1.plot(time, meas, 'b')
ax1.grid()
ax2.set_ylabel('Force [N]')
ax2.plot(time, cont, 'g')
ax2.grid()
ax3.set_xlabel('Time [s]')
ax3.set_ylabel('Derivative Term')
ax3.plot(time[1:], diff(meas)/diff(time), 'r')
ax3.grid()
plt.show()

As It can be seen in the figure, derivative term cannot be use without a filter:
alt text

Installation

To install, run:

pip3 install advanced-pid

Tests

To run tests, run:

python -m unittest tests.test_pid

License

Licensed under the MIT License.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

2 collected
advanced_pid-0.0.8-py3-none-any.whl

bdist_wheel · 5.94 KB · Python py3

Source file
advanced-pid-0.0.8.tar.gz

sdist · 5.13 KB · Python source

Source file

Repository

ACCESSIBLE
eadali/advanced-pid

Shared repository data · GitHub

License detected in repository
MIT
License branch / ref
main
Last push
29 Jun 2022
Archived
No
Contributor identities
— · partial collection

Public sponsor counts have not been collected. These signals belong to the repository owner.

Downloads & popularity

1count
Gauge · observed snapshots22 Oct 2026
10.50
2026-10-22: 1 · observed 2026-10-22T21:39:05.6237833Z
22 Oct22 Oct

github · 1 observations shown. Missing days are unknown.

View observed values
Date / source periodValueObserved at
2026-10-2212026-10-22T21:39:05.6237833Z

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:58 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:95157e3580917623ccc1e2d6de3735e5aadc2995d7e67e99a2d2a271a1be4ce1

Other collected versions

View all collected versions →