Temperature Control

More
2 years 6 months ago #297469 by PCW
Replied by PCW on topic Temperature Control
Yes, it would be nice to have a single ended PID comp or PID mode.

Maybe better would be a  more temperature control friendly comp
that implements MPC or similar.

You could use the "near"  or "comp" components to enable your pump.
 
The following user(s) said Thank You: lkavan

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago #297472 by andypugh
Replied by andypugh on topic Temperature Control
You could also use wcomp or comp to disable the PID when the temperature was above setpoint. I am not sure how elegantly that would work, though.

If the problem is integral wind-up when over-temperataure then one solution might be to set up a second lincurve component that sets the I-gain to zero when the error is negative.

I used to tune vehicle idle speed controllers, and those used this idea, except that P, I and D gains were all 8x8 maps agains error and coolant temperature.

Please Log in or Create an account to join the conversation.

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 or Create an account to join the conversation.

More
2 years 6 months ago - 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. 
Last edit: 2 years 6 months ago by andypugh.
The following user(s) said Thank You: lkavan

Please Log in or Create an account 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 or Create an account to join the conversation.

Time to create page: 0.133 seconds
Powered by Kunena Forum