Author Topic: Autotune PID C code microcontroller start point  (Read 1074 times)

0 Members and 1 Guest are viewing this topic.

Offline Vindhyachal.taknikiTopic starter

  • Frequent Contributor
  • **
  • Posts: 490
Autotune PID C code microcontroller start point
« on: November 21, 2019, 03:03:11 pm »
1. Want to write autotuen PID for heater application. Can you point to some good starting point for c code?
2. Any reference library for this?
3. tried autotune arduino PID library, but temp is oscillating at set point.
 

Offline Mattjd

  • Regular Contributor
  • *
  • Posts: 230
  • Country: us
Re: Autotune PID C code microcontroller start point
« Reply #1 on: November 23, 2019, 10:47:39 pm »
Id suggest tuning the gain values in say simulink or by hand and then transferring to C.
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4705
  • Country: au
  • Question Everything... Except This Statement
Re: Autotune PID C code microcontroller start point
« Reply #2 on: November 23, 2019, 11:18:47 pm »
Split it into 2 parts, the PID control, and the autotuning,

Each of these have a number of approaches, but lets say we stick to the normal PID control

So you now want to auto-tune it, the most common approach is called "step response", where it fixes the output, wait for it to stabilize, change the output by a step of x% wait for it to stabalise, and using the data between those 2 points to work out which values you want (sometimes PI or PD control can behave better than PID)

I would begin by putting together the PID or reusing an existing one, you can do auto-tuning with normal PID libraries,
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11714
  • Country: my
  • reassessing directives...
Re: Autotune PID C code microcontroller start point
« Reply #3 on: November 24, 2019, 04:49:24 am »
the academic version is called "adaptive control" or maybe the "robust control", prepare for heavy math belt. the non-academic, or maybe the empiric method is Ziegler–Nichols tuning method but its heuristic and meant to be done manually by human anyway...trying to do that automatically in code probably resulting in less than ideal time solution, and re-testing, adjustment or recalibration probably will interrupt the working operation of the system, hence the "adaptive" method is developed, i've never tried any of them so this is just a wild guess.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf