Mapping PID to digital domain

Status
Not open for further replies.

vinayakdabholkar

Advanced Member level 4
Joined
Nov 29, 2009
Messages
114
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
goa
Visit site
Activity points
2,195
I want to implement a PID controller on micro-controller. I have the transfer function of the analog PID controller

I also saw on the net there are three constants Kp,Ki,Kd which form part of PID controller. Cant understand what they mean in the transfer function i have attached. I have implemented the controller using an op-amp succesfully, now how do i go about the digital implementation ?
If someone can help me understand this concept and help me to startup
The PID is for controlling a buck converter. Vo=1.2V vref=1.2V Fs=500K, loop crossover Fo=60K
 

So I recognize that equation as the form of a type III compensation network used for analog control circuitry. Such a circuit only approximates the behavior of an "ideal" PID controller (because an ideal differentiator cannot exist in a real circuit). So if you just want to implement a PID loop on a MCU, it would simpler to forget that equation and just implement it using the normal time-domain model of a PID. Trying to implement the type III compensation transfer function digitally will be more complicated, and require much more computation from the MCU.
 
As mtwieg suggested, you need to convert the equation to the S-plane transfer function in the form shown here and then use that to generate the microprocessor program. Look down the page for the paragraph titled "Laplace form of the PID controller" That also explains what Kp, Ki, and Kc are.
 
Time discrete PID implementation can be done by applying z-transformation, or in other words converting the continuous differential equations to difference equation. You'll find tables of equavalent z-domain PID parameters in any digital control text book, here's the basic concept https://en.wikipedia.org/wiki/PID_controller#Discrete_implementation
 
Thanks for the replies. As you had pointed to the PID wiki link ,i went through it. So i see that the analog and the digital implementations differ a lot.
It is possible to tune the PID with the manual methods explained. So the attached pic is the pseudo algorithm. In the analog PID i had placed the first zero at 60%, then 120% of FLC (double pole frequency) and had observed changes in the settling time.
Is that code on the wiki page enough to work as similar to the analog PID. I am a lot confused here.
Should i take the transfer function (analog transfer function) apply z- transform and then write an embedded code for that discrete transfer function ?
 

Presumed you implemented the digital PID correctly, there won't be a behavioral difference if the sampling frequency is high compared to characteristic control system frequencies. But usually digital controllers are designed with moderate sampling frequencies where time discretization matters. Dead times play an important role. The straightforward way is to identify the control system parameters and design the controller completely in the z-domain.

If you are setting PID parameters empirically, you can still apply tuning methods like Ziegler-Nichols.
 
My controller had a control loop bandwidth of 60K and the buck converter switching was at 500K. So when i substitute s=(2/T)*(z-1/z+1) for transforming the transfer function to the Z domain how much should T be ?
 

I have the laplace domain transfer function for the PID , is it possible to determine the gains Kp, Ki and Kd from it ?
If i adopt any other method other than taking the z transform of the transfer function of the PID how will i be sure that the PID will behave the same as the analog one before implementation is done ?
If i transform the laplace domian PID to Z domain i can check the responses of both of them to a step and see if they are the same
 


now i understand what you had said. While transforming this type III compensator to z domain it is very computationally extensive and will indeed require a lot of computation
Is the normal time domain model you are talking about is this equation =kp+kI/s+Kds ?
How do i start about by this method then ? From where i decide kp, ki and kd ? can i get them from the type III compensator transfer function ?
How will i know know my designed compensator behaves like the analog one before implementing it on the MCU
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…