PymateIO-PID-controler: Difference between revisions

From pymate.io wiki
Jump to navigation Jump to search
Line 3: Line 3:
== Software PID ==
== Software PID ==


The PymateIO includes the {{fname|PID}} class ({{fname|pid}} library). This controller have been deployed with success into the [https://github.com/mchobby/plancha-cms Plancha-CMS project].
The PymateIO includes the {{fname|PID}} class ({{fname|pid}} library).
 
{{dbox-orange|This controller have been deployed with success into the [https://github.com/mchobby/plancha-cms Plancha-CMS project].
 
Do not hesitate to read the [test_pid.py](https://github.com/mchobby/plancha-cms/blob/main/examples/test_pid.py) of Plancha-CMS for implementation example.}}


The PID controler do use a Time to perform its treatments.
The PID controler do use a Time to perform its treatments.
Line 12: Line 16:
* Kd : Derivated constant
* Kd : Derivated constant


The software controler requires additional parameters:
The software controller requires additional parameters:
* dt: time (ms) between two consecutive measurement
* dt: time (ms) between two consecutive measurement
* measure_func : the function that returns the PID input value.
* measure_func : the function that returns the PID input value.
Line 21: Line 25:
The PID controller '''starts''' when setting the setpoint (see {{fname|setpoint(value)}} ) and '''stop''' when {{fname|stop()}} is called.
The PID controller '''starts''' when setting the setpoint (see {{fname|setpoint(value)}} ) and '''stop''' when {{fname|stop()}} is called.


{{dbox-gray|1= A typical application of PID would be a speed regulation:
{{dbox-gray|1=A typical application of PID would be speed regulation:
* Kp, Ki, Kd : to determine
* Kp, Ki, Kd : to determine
* dt = 100ms
* dt = 100ms

Revision as of 02:11, 30 June 2026


Software PID

The PymateIO includes the PID class (pid library).

This controller have been deployed with success into the Plancha-CMS project. Do not hesitate to read the [test_pid.py](https://github.com/mchobby/plancha-cms/blob/main/examples/test_pid.py) of Plancha-CMS for implementation example.

The PID controler do use a Time to perform its treatments.

As for each PID Controller, the following parameter are required:

  • Kp : Proportional constant
  • Ki : Integral constant
  • Kd : Derivated constant

The software controller requires additional parameters:

  • dt: time (ms) between two consecutive measurement
  • measure_func : the function that returns the PID input value.
  • output_func : the function(value) called by the PID controler to set the output.
  • output_min : minimal value for the output.
  • output_max : maximal value for the output.

The PID controller starts when setting the setpoint (see setpoint(value) ) and stop when stop() is called.

A typical application of PID would be speed regulation:
  • Kp, Ki, Kd : to determine
  • dt = 100ms
  • measurement_func : returns the RPM
  • output_func : set the PWM duty cycle (in percent)
  • output_min : 0
  • output_max : 100

PymateIO all right reserved © 2026 - Written by MCHobby for PymateIO