Temperature Control

More
2 years 6 months ago #297475 by PCW
Replied by PCW on topic Temperature Control
Also adding some bias to the PID output  or FF0 might help
(since at a fixed high temperature, this would better match the model)

Please Log in to join the conversation.

More
2 years 6 months ago #297552 by andypugh
Replied by andypugh on topic Temperature Control
A basic PID controller is very little code at all. Here is an off-the-cuff attempt in the .comp format. 

Code:
component tpid "A pid component for temperature control"; pin in float command; pin in float feedback; pin out float output; pin in float Pgain; pin in float Igain; pin in float Dgain; license "GPL-2.0+"; author "andypugh"; ;; static double prev_error; static double integ; double diff; double error = command - feedback; integ += error * Igain; diff = (prev_error - error) * Dgain; prev_error = error; output = error * Pgain + integ + diff; if (output < 0) {     output = 0;     integ = 0; // Might be right, might be wrong.  }

I haven't actually tried to compile or run this (it's late here). But something very like this, with a few tweaks, would probably do all that is required. 

Note that this implementation is absolutely _not_ robust against changes in the servo thread rate. If you change that setting it would need completely re-tuning. 

Please Log in to join the conversation.

More
2 years 6 months ago #297760 by lkavan
Replied by lkavan on topic Temperature Control
Well, is it possible to create own HAL component? Then it can work, yes, I know PID algorithm. I will try to find how to compile and use. Will be nice to create such temperature control component also with temp_ok signal.
PCW: Thanx a lot, "near" is what I looked for!

Please Log in to join the conversation.

Time to create page: 0.053 seconds
Powered by Kunena Forum