Sign in to follow this  
Followers 0
lchamarthi

PIDAuto tune Formula

11 posts in this topic

I was searching for PIDAT (PID Auto tune) hidden formula how in PLC might have implemented inside the instruction. Because I have one embedded task to be done with PIDAT function which is not built in. PLC suppots built in PIDAT function If any one had the formula, can you please share to me. Thanks

Share this post


Link to post
Share on other sites
There are many autotuning algorithms. Without any additional information there is no way to determine which one you are seeing. There is no such thing as a perfect autotuner. Good autotuners are rare and difficult to program. This makes them very valuable assets to the vendor. This means that they are usually considered very proprietary information. Even if you identify which autotuner you want to know the algorithm for, it is very, very unlikely that you will be able to find that information because it is a secret. From a practical point of view, I have never seen an autotuner that works reliably, not even an adaptive loop type. I realize that this disappoints the DCS folks but it's the truth.

Share this post


Link to post
Share on other sites
Click here. Happy reading.

Share this post


Link to post
Share on other sites
This assumes that lchamarthi wants to auto tune a temperature system. A position system is much different.

Share this post


Link to post
Share on other sites
That is because you haven't used a good one or the models the auto tuner used did not match the model of the thing being tuned. For instance a FOPDT or SOPDT auto tuner will not tune a motion system. Here is how a temperature system is auto tuned. Dig into this. http://www.deltamotion.com/peter/PDF/Mathc...sid%20SOPDT.pdf 1. On page 1/10 I define the ideal SOPDT system. I chose different value to to see how the well the system identification works under different conditions Notice that there is dead time and I don't assume all the poles are at the same location like others on this newsgroup. 2. At the bottom of page 2/10 I generate the test data that is later to be used for system identification. I add noise the to ideal data just to simulate reality a bit. The CO(t) function is a few steps. The function can be arbitrary but I have found that the excitation is critical to the identification. Dead times and time constants are determined more accurately if the are step or rapid changes. The gain and ambient coefficients are determined more accurate if the are steps at different levels. 3. One page 3/10 I plot and save the generated test data. I can post it on my FTP site for you to practice with. Notice that this data has dead time and two poles that aren't at the same location. I could have added more noise but the quasi-Newton method seems to filter it out well. 4. One page 4/10 the system identification is done. Mathcad's Minerr function can be like either Scilab's optim() function or lsqrsolve function depending on the option chosen. I chose the quasi-Newton optimization which is similar to the optim() function. Runge-Kutta is used to integrate the differential equation. The differential equation doesn't need to be linear. I could easily put a none linear term in there like one that changes the gain as a function of temperature. This happens with heat exchangers because of the LMTD. Fluid systems are often of the form v'=g/m-K*v^2. It is easy to ID non linear system IF you know the general form of the equation and just need to ID the constants. Notice that the ID'd poles are closer together than the real poles. I have notice that system identification tends to ID the poles closer together than what they really are. Notice that I all ID a dead time and an ambient temperature. This is something that JCH does not do. At the bottom of the MSE(), mean squared error function, is where I calculate the mean squared error between the estimated temperature and the actual or test data temperature. The Minerr function adjusts Kp,t1,t2,thetap, and C till the MSE is minimized. You can see the results are not perfect but that is reality. 5. On page 5/10 the actual or perfect response is compare to the estimated response. The response looks close, almost identical, even though the system identification puts the estimated poles closer together. Also notice that a good system identification routine can ID systems that are excited by more than just a step change. In fact they must must be able to do system identification with arbitrary excitation. Above I said the excitation is the key to doing system identification. One key is the make multiple steps at different levels. This is very important in computing the gain and computing the gain when it isn't linear. Heat exchanger's gain changes because of LMTD. ( log mean temperature difference ). 6. On page 6/10 PID gains are calculated using the estimated plant parameters found by system identification. My formula is a little more complex that the IMC formulas but the response is faster/better for the same closed loop time constant. I doubt the extra complexity in the formula is worth the effort for most applications. 7 Page 7/10 simulates the PID control of the original system using the gains calculated from the system identification. Notice that feed back noise is simulated as well as the dead time. 8. Page 8/10. The simulation show the response. The response isn't perfect because there was noise in the original data used to do the system identification. The system identification is not perfect because the poles are closer together than they should be and I simulated noise on the feedback but this is closer to reality. 9 Page 9/10 uses the internal model gain formulas that I got from the www.controguru.com site. They work well too and are much simpler they don't work quite as mine. I should have provided a IAE value for my gains and the IMC gains for comparison. 10 page 10/10 shows the IMC response is a little slower but most would be please with it. I would like to know if anybody understands this.

Share this post


Link to post
Share on other sites
Peter. Without getting too involved in the detail I would say that your system works in a similar way to software packages such as Expertune and these packages generally work well. My take on the OP's question was that he is looking for the kind of thing built into many single loop controllers and I have never found one of these which works on the type of loop used as an example in your paper. The main issue with these controllers is that they cannot /will not wait for 40 minutes while a step returns to steady state. The amount of data which would need to be stored would probably preclude this for most controllers. Since your example is typical of the process heating loops I am familiar with this renders most built in autotune systems unusable. Oddly enough I have always assumed, probably incorrectly, that autotune would be easier for motion where responses are much faster and easier to identify. Edited by andybr

Share this post


Link to post
Share on other sites
It doesn't take that much memory to store 40 minutes worth of data. It would easily fit in 64 Kbytes accessible by an 8 bit micro controller. The PV doesn't need to return to a steady state. It must start at a steady state. Motion control and temperature control systems are quite different but the math used to do system identification is the same. It is clear that the OP was expecting a simple formula and didn't want to strain his brain. It doesn't look like anybody really understands the math involved. The problem I have with questions like this is that everyone thinks the answer is simple. It isn't. If you don't understand the math the is all a foreign language. It you can find all the information you need to do auto tuning on the internet but no one wants to put the effort into it to understand the math. This post proves my point. Suck it up and strain your brain or pay for someone else that has done so.

Share this post


Link to post
Share on other sites
I actually wanted a c code for this PIDAT

Share this post


Link to post
Share on other sites
Why didn't you say so so I wouldn't have wasted my time.

Share this post


Link to post
Share on other sites
void auto_tune(PID, process_time_constant, process_gain, process_deadtime) *sPID PID; float process_time_constant, process_gain, process_deadtime; { *PID.Kp = calcK( process_time_constant, process_gain, process_deadtime); *PID.Ki = calci(process_time_constant, process_gain, process_deadtime); *PID.Kd = calcd(process_time_constant, process_gain, process_deadtime); } Now you may think I'm not being very helpful at this point, but if you will look again then you will see that there are three really big hints about what you need to to learn and understand. If you can understand and then measure them, then you can tune anything. And if its something you don't do very often, you can then tune several loops on $6.00 calculator in less time that it will take to write and compile a C program. Teaching it is way beyond the scope of a forum post, your are going to have to study. BTW, if you can't first program a PID equation in C, then IMO attempting to program an autotuner is futile.

Share this post


Link to post
Share on other sites
The formulas for Kc, ?i as a function of those parameters are on controlguru.com The trick if finding the process_time_constant etc. Edited by Peter Nachtwey

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0