Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

Author Topic: Autotune PID  (Read 1992 times)

berghem

• Jr. Member
• Posts: 57
Autotune PID
« on: June 20, 2021, 10:02:36 pm »
Hi all
I developed OT application with Lazarus on raspberry PI, I implemented PID algorithm, I need a AutoTune PID library but I didnt see anything.

Can you help me?

jamie

• Hero Member
• Posts: 4735
Re: Autotune PID
« Reply #1 on: June 20, 2021, 11:50:07 pm »
I don't think you will find one that fits your needs/Code..

Auto tuning a PID requires a set point and process value of course.

P = comes in different flavors GAIN or Bandwidth..

For heating it's normally proportional band width which means it dictates the output level depending how close to the Set point the process value it. To high of a P value may not allow you to reach your goal, to small could make it jittery..

The (I) integral for heat controllers is basically a time sampling factor.., basically amount of ms to sample and sum the error before making output adjustments.

The (D) derivative is a rate which the clime of heat is allowed. Higher values normally will retard the output lower or longer..

etc.
Like I said, I think you are on your own
\

P.S.
Auto tuning involves slamming the output on, measuring the rate of clime for heat and the rate of decline for cooling from the set point, once the first value is reached you lower the output to half of that in both directions and keep flags around to know at what point you are at.. If it takes too long with the new values then  you split those values between the old and new etc.

« Last Edit: June 20, 2021, 11:53:00 pm by jamie »
The only true wisdom is knowing you know nothing

avra

• Hero Member
• Posts: 2187
Re: Autotune PID
« Reply #2 on: June 21, 2021, 01:00:27 am »
I need a AutoTune PID library but I didnt see anything.
There are plenty of Arduino libraries which should not be too hard to convert: https://duckduckgo.com/?q=arduino+autotune+pid
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib