Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me debug a code for auto tune pid

Status
Not open for further replies.

lats

Full Member level 4
Joined
Oct 27, 2005
Messages
216
Helped
13
Reputation
26
Reaction score
6
Trophy points
1,298
Activity points
2,945
auto tune pid?

Hi all,

i am new to pid temperature controller. i have studied many links and basics i got a link on this forum were a person has explained pid very basic .the link is


Simple PID

PID = GainP * actual error + GainI * SUM(previous errors) + GainD * (actual error - last error)

error = sp(set point) - pv(process value)


float pid (float sp, float pv)
{

err_old = err;
err = sp - pv;

// note
P_err = err;
I_err += err_old;
D_err = err - err_old;

return 0.1*P_err + 0.3*I_err + 0.02*D_err;

}

now here he has set the values "0.1 ,0.3, 0.02" as constants .
this doesnt seem to be a auto tune code. what changes will i have to make and how.
 

Re: auto tune pid?

I like to see a well formed answer for this question, as im also interested.

The auto-tune means. amplification constants in pid algorithm are change during work flow of device... Changed based on ? ? ? on... time and error, because tease 2 parameters are reason why ur using algorithm. tease parameters are changes in a way that quality of your regulated process improves.

How ?
if you got stable and pattern like process then you can do it easy way (better of ... result) if no then it will be long and complicated task.
 

Re: auto tune pid?

I would recommend you modify PID formula a bit:
PID = GainP * ( actual error + SUM(previous errors) / Ti + (actual error - last error) / Td
where Ti - integral time, Td - derivative time.
In this case all terms will be normalized.
PID tuning process is a complicated procedure based on controlled object behavior.
Brief explanation of PID params influence on PID behavior you can find in this doc: https://termexlab.ru/upload/filearchive/363_M03 manual.pdf.
See chapter "PID controller parameters".
 

auto tune pid?

Td must be a factor, not a divisor in your PID formula.
 

Re: auto tune pid?

It's up to you, tastes differ. You may use a factor Kd instead of Td in the case if Kp=1/Td, but Td has a physical sense as a time constant of differential stage in PID controller. I wrote that multiplication of integral & diff terms by proportional gain makes PID more robust and easier tuned.
 

Re: auto tune pid?

It's up to you, tastes differ. You may use a factor Kd instead.
I don't mean changing to a factor Kd. If Td has the physical sense of a time constant, you have to correct the differential term to
Code:
(actual error - last error) *Td/Ts
Ts is the controllers sampling time interval. In other words, decreasing the Td time constant decreases the "D" gain, while decreasing
Ti increases "I" gain. Check with your actual PID code or a text book.
 

Re: auto tune pid?

Oh, sorry, you are right for sure! I've been very negligent. Thanx.
 

auto tune pid?

who has ever tried GA for tuning pid parameters?
 

Re: auto tune pid?

There are better control algorithms for a tuning mechanism than PID.

I would look into programming an estimator.

PID is a good cheap controller, but if you dont understand fully the system it is not the best to use.

I built a full-state feedback system awhile back and it worked much better then PID.

Also you could take a look at some of Kalmans work on the topic.

Are you modeling the system first of just 'over-engineering' it?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top