- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what code are you struggling with?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The PI controller algorithm presented by maha.eg can be found quite often in literature, it's also quoted as velocity algorithm, because the controller output u(k)-u(k1) represents the change rate of manipulated value. It's main advantage is that it allows to stop integration exactly at the limits of the manipulated value u(k).
Besides the shown variant of the algorithms, which refers to trapezoidal integration, there's also a rectangular integral variant. My digital control text book mentions, that the difference between both is neglectable for short sample periods. u(k)=u(k-1) + err(k)*kp + err(k-1) * (ki*ts - kp)- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Kaz and FvM for your replies
Kaz your diagram describe my equation, does this mean that my equation is correct and can be used? but i can't get the experimental results where i'm programming the equation in FPGA by VHDL language. FVM thanks for your reply, but do you mean from your equation that i must replace my equation by your equation. please clear for me what is your idea? thanks very much for all.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know about the equation, I just copied it from you.
Whether it correct or know, I think FvM confirmed it and he is really the Guy who knows about all that techno stuff. But I implemented it as diagram. You need to make sure you get your computation are correct especially issues of truncating bits at results. You need a math model and simulate first before you move to actual real time system- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks james for you reply. I will study this paper.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One of the key issues in implementing this type of controller is how to handle the clamping function. Think about how to wrap a finite state machine controller around the main PI; to enable the integrator after the clamp has cleared in an appropriate manner. This topic is in addition to how to handle the bit growth of the accumulator; which is an issue in any FIR or IIR filter design. -James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
what about the relationship between Kp, Ki, Kd and the width of the input signals? For example if i have input data coming from a 12bit ADC with 5V analog range and a 12bit ADC with 2.5V analog range (so the same input voltage is rapresented with different words) are the PI parameters affected by this?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The ADC and DAC scaling isn't part of the digital controller, but it obviously affects the feedback loop gain. I think the plant model should take account of it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello James,
I have to design a pid servo for power stabilization of the lasers . I have thought of the closed loop design involving the experiment and the feedback. I read your paper on the pid controller and was wondering about what should be the sampling interval for the integral component and how to implement it in vhdl. My ADC's and DAC's work at maximum frequency of 10 MHz and 25 MHz respectively. Does that mean for the PID , I can have a maximum frequency of 12.5 MHz (half the frequency of DAC). Secondly, how to use the inverse of this frequency (sampling interval) in the difference equation that you have given in your paper. Thanks.- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page