POL
ENG

PID regulator with autotuning feature

Theory of controlling values are very complex. It depends on many factors e.g. what do we want to control (temperature, rotation, light level, etc.) and how do we control it (valves, relays, motors, etc.). All those things are far from ideal models, so it not so easy to describe easly dependency between them. Generally, we have a few types of controllers:


  • PI – proporcional-integrating
  • PD – proporcional-differentiator
  • PID – proporcional-integrating-differentiator

Depending on needs, appropriate controller should be used. Last combine features of first two, but it is not perfect for all situation though. Very often, it turning out, PI to be satisfying. Also, with growing complexity of device, its cost also grows. So, there is no sense to spend money on expensive controller where it is not needed.

Described here device was built as master of sience thesis made for PREVAC company. Unfortunately, because of copyrights I can't put source files here.


This device is made to control temperature. We can distinguish three modules:

  • temperature measurement
  • controller
  • output driver

Temperature measurement

As a temperature sensor I used thermocouple. There is a possibility to use types: J, K, B and also sensor PT100. Measure techniques with those sensors are widely described in literature and in the Internet, so I will not describe it here. A few thing worth to mention. They have not linear characteristic. That means, that your code must somehow equalize them. I used Look-Up-Table as the fastest (for me) method. You can use polynominal equation, but I thought I will not overload ATmega128 brain to do it many times per second. Another thing is an effect of "cold junction". To compensate its influence on measurement, I build in small temperature sensor on a board. Value from this sensor is added to value calculated from thermocouple.

Signal from thermocouple is on level of mV. I had to amplify it. I used differential aplifier. Its gain is calculated to cover range 0-5V for range from -100 to 1200 Celcius degree. This signal is delivered to 24-bit ADC and read by microcontroler via SPI interface.


Output driver

After all calculation in microcontroller, output value is adjust to drive 12-bit DAC. Range is calculated in such way, to cover range 0-10V. This is necessary to correctly drive power-end.


Controller

Linear data from LUT table are used to count output value using PID equation:


y = P*e + I*(e[0] + e[1] + … + e[n]) + D*(e[1]-e[0])



where:

e – error between preset value and measured

P – proporcional coefficient

I – integrating coefficient

D – differentiator coefficient

Quality of regulations depends on P, I, D coefficient. This is the hardest part. People with many years of experience are able to count those values knowing type of object and time to response on change of preset value. Main topic of this thesis was implement an algortm of automatic calculation of those values in device. I used Nichols-Zigler method. I can't describe details because of copyrights, but you can find materials in library or in the Internet.


Communication with this device is realized via RS232. PC application may write/read parameters and current value. Everything is presented on chart.





Add comment


Wszelkie prawa zastrzeżone. Projekt i wykonanie strony SrcPro.pl