Forum Discussion
Altera_Forum
Honored Contributor
14 years agoPI controller in VHDL
I'm trying to implement a PI controller in VHDL. where i tried a lot but i failed
Please, can any one help me to achieve this task where i'm new in this field.14 Replies
- Altera_Forum
Honored Contributor
i would like to tell you the equation of PI controller that i used:
u(k)=u(k-1) + err(k)*(kp +(ki*ts/2)) + err(k-1) * ( (ki*ts/2) - kp) where: u : is the output of controller. err: error signal that injected to the controller. kp: proportional constant. ki : integral constant. ts : sampling time. - Altera_Forum
Honored Contributor
Thanks very much for your replies.
thanks Kaz i understand the proportional term but rely i didn't understand the integral term. can you explain it again and with its equation? note: for the proportional term there no value for sampling time. - Altera_Forum
Honored Contributor
I have done sort of PI that consisted of two branches only (proportional and integral parts). I used it for phase error control in a receiver carrier tracking.
It was very simple in vhdl (but have the code misplaced). The proportional part is just a multiplier; you multiply the error(input) by a constant (I used .1 ~ 200). The integral part is just an acuumulator; you add up the error nonstop and hopefully will not overflow. You will need to add a term here to decide how much to feedback = leakage (e.g. .001 ~ 1), again needs multiplier in the accumulator loop. The two branches are just added up. Testing is more difficult and best is in-system testing - Altera_Forum
Honored Contributor
what code are you struggling with?