Auto-tuning Pid Loops

Join Date
Feb 2003
Location
Oxfordshire
Posts
37
I have recently been playing about with some pid loops for temperature and pressure control with varying results. I could do with being able to tune the Proportional, intergral and deferential comonents automatically!

Does anyone have any auto-tuning PID Blocks for Siemens S7 that they would share? I would appreciate it greatly!

Regards

Barry Humphries
 
Do not have Siemens but Omron CS1H and CJ1H have autotuning built in
beerchug
 
Unfortunatly Bob, our site standard is Siemens and replacing over 300 PLC's for Omron's just for there PID loops alone is not quite justified... I can see the capital proposal now.....

In order to use auto-tuning PID loops we need to replace all of our PLC's with Omron.

Cost, £3,000,000

Benifits, only PID loop auto-tuning...


Maybe not... but keep them idea's comming!

Thanx

Barry
 
If the PLCs filling your plant don't have autotune, you are going to either roll your own auto tune or manually tune.

Now, let's just say to start with that auto-tune is not magic. Most auto-tune algorithms operate by perturbating the process (usually causing a disturbance with a step change in output, but sometimes with a step change in setpoint). The algorithm then watches the response of the process variable and calculates intial tuning constants with Ziegler Nichols or some similar technique. That gets you a starting point for the PID tuning, and from there you can modify the tuning as needed. From what I have seen and heard you can't often just hit the autotune button and walk away because your process is now optimized!

You can certainly roll your own autotune by duplicating the above process in logic, or you can certainly manually use this procedure to determine intital tuning constants. Or you can use cut and try tuning methods, quickly gaining the experience to make it fairly painless if many of your loops are similar. I reccommend the latter, and Peter Natachaway has posted some great PID tuning advice over the years.
 
I have been searching for a while trying to figure out what are the units for ZIEGLER-NICHOLS kc, ti, and td are.

The equation for Kc= Ku/1.7
Ti=pu/2
Td=pu/8

Does anybody know?

Sam
 
Barry, doing a decent autotune in ladder will be very difficult. Even the STL code would be BIG. Beware of those autotuning systems that just pick a few points to model a system. Picking the key points can be very subjective and a subjective error can have dramatic consequences.

I think the best 'autotuning' would be off line where the data can be crunch by your PC's pentium. I use a technique called least squared system identification. It tries many iterations to find the best models and sample rates. It works very well if you know how to use it. Then I use pole place to get the desired results. The problem most PLCs have is that they have no data logging capabilities like the Trends that are part of RSLogix 500 and 5000. ( I know nothing about RSLogix 5 ).

Tom, do a search on Natachaway and see if you get any hits. ggrrr. I know it isn't easy to spell unless you know German. There was a small German lesson in another thread that applies here.

Finally, I am recovering from my PID thread, but does anybody want a ZN tuning example on RS500? Personally, I think ZN is obsolete, but it is free and not too difficult to implement. Last summer Ron Beaufort paid $30 for a document on Lambda tuning. I wonder what it says. I know the Lambda tuning is similar to the pole placement I use.

What do people do to gather data similar to a trend on a S7-300 system?
 
Omron CS1 and CJ1 PLC's have autotuning built in. Attached file shows information regarding 2 degree of freedom autotune PID function.

Particularly interested in comments from Peter Nachtway regarding this function. Does it appear to give a good result? I might add that Omron 2 degree of freedom temperature controllers work very well for most applications. Have used them many times with excellent results.
 
I have been searching for a while trying to figure out what are the units for ZIEGLER-NICHOLS kc, ti, and td are.

The equation for Kc= Ku/1.7
Ti=pu/2
Td=pu/8

Sam,

You questioned the meaning of the variables. Here is what I know (not much).

Remove Derivative completely from the loop before trying this. Also take the Integral out to the longest time allowed (I usually use 500)

Pn(Pu) = Natural period of the loop or system. Expressed in minutes. This is best determined by increasing the gain and upsetting the loop. Keep increasing the gain, upsetting the loop, until the output rings uncontrollably or without decay (yea, get permission to do this on an online system). Measure the period (P to P) of this "ring", and you have Pn in minutes.

Kc = Gain = Gain is an expressionless unit. Think of it as a ratio of input to output. (1 = for every unit of change in the input, the output will change by 1 unit).

Kn(Ku) = the gain necessary to create a "natural" ring of the system.

Ti = Time of integration (integral)= Usually expressed in minutes. The equation used in your question is used to determing a starting point for initial tuning.

Td = Time of derivitave (derivitave) = Usually expressed in minutes. The equation used in your question is used to determing a starting point for initial tuning.

Here are the "rule of thumb" calcs I use. This would be considered a fairly agressive "tune". I usually do not use Td:

Pn = Natural Period
Kc = Kn/2
Ti = Pn * 1.2
Td = Pn/8

Hope this helps
David
 
Last edited:
Dave:

Thanks, This helps. Some of difficulties I have, I am trying to tune heat barrels on a machine. Some of these heat barrels are 1800 watt. It is difficult to see the natural peaks. The heating response is very slow. So far I have been able to come up with a gain that will get me close a few degree below the setpoint. Now, I can probably introduce a large gain to look for the the peaks. Again, the problem is that barrels are made of metal and takes a long time to loose a couple of degrees for the down peak.

Thanks;
 
Barry

Siemens offer many different PID implementations for S7. Depending on which of them are using, self-tuning may already be available.

In the STEP7 Standard Library, there is a folder entitled PID functions. There are 4 blocks there: FB41, 42, 58 and 59. The first two do not offer auto-tuning as a standard feature, the latter two have it built-in. There are also additional PID FBs and supporting blocks (the so-called Standard PID and Modular PID packages) which Ron's post linked to. The PID Self-Tuning software can be applied to any of the Siemens PID control blocks which don't already have it. It is an extra FB which you load to the PLC and link to the PID FB.


By the way, would you like someone to send you the PLC free-of-charge as well? I believe Siemens charge people for hardware as well as software...

Ken
 
More arrows in the quiver.

BobB said:

Particularly interested in comments from Peter Nachtway regarding this function. Does it appear to give a good result? I might add that Omron 2 degree of freedom temperature controllers work very well for most applications. Have used them many times with excellent results.

I think the two degrees of freedom trick is a good one. I don't like the name 'two degrees of freedom'. Freedom from what? Over the summer we experimented with different forms of PID. My farvorites are the PID and I-PD where the P and D terms rely only on the PV changes. The two degrees of freedom allow one to 'blend' the two types of PIDs togethers by using a beta and gama term that are used to blend the proportional and differetial terms like so.

u(n) = u(n-1) + Ki*T*e(n) + Kp*(Beta*(e(n)-e(n-1)-(1-Beta)*(pv(n)-pv(n-1)) + (Kd/T)*(Gamma*(e(n)-2*e(n-1)+e(n-2)-(1-Gamma)*(pv(n)-2*pv(n-1)+pv(n-2)))

The beta and gamma allow one to phase in the zeros or adjust the gains of the zeros in the transfer function. Zeros are good for high bandwidth systems. They are bad when makes step jumps in the SP because the output will saturate.

I know this is clear as mud and that is the problem. The two degrees of freedom PIDs are good but what do you do with the beta and gamma? I can figure output what to do with the Beta and Gamma by looking at the bode plots.

Bode plots showing the difference between PID, PI-D and I-PD.

Notice the I-PD does not ever have it gain go above 0 db or 1 and the PID and PI-D do. One can use the beta and gama to reduces the gain at frequencies where the transfer functions gain goes above 1 or 0 db. This can make the response flatter which is a good thing.

So how good are your Bode plots?

BobB, there wasn't anything in you attachment about two degree of freedom PIDs.
 
Last edited:

Similar Topics

hiii i'm using Siemens S7-200 (PID Control Panel) to control speed of DC motor. I have sensor which detects speed of motor [0V ; 2.84V] and...
Replies
6
Views
4,813
http://www.controleng.com/article/CA6626810.html?nid=2361&rid=1263151521 You can see that not all auto tuning is created equal. What gets me is...
Replies
5
Views
5,168
Hi everybody! I have a problem with PID,Please help me! Because I want change speed motor according to a set value.I want to make a weight...
Replies
1
Views
4,087
PID auto tune Who can tell me how I can get a program to auto tune a PID controller in S7 Siemens S7. Wie kan mij vertellen waar ik een...
Replies
3
Views
17,567
Attached is a zip file that contains a python script that calculates the PID gains for SOPDT systems. You must install python3, numpy, scipy and...
Replies
2
Views
2,687
Back
Top Bottom