SLC 500 5/03 PID loops

Drewcrew6

I haven't thought about logs, could be an idea later!

I think at this stage I would prefer to keep it as simple as possible so that I can get a heating controller up and running fairly quickly, I do have a second SLC rack for me to do other learning on.

What's this sequencing each zone through one PID? How on earth do I do that? do you have any examples? as yet I haven't got a PID up and running yet.

Normally I use Temp PID controllers and set them to autolearn so I have to learn this for optional PID
 
I have another idea on CPU resource conservation with lots of PIDs. Since ChrisFlint's PIDs are going to have long update times, it shouldn't require that the PIDs be excuted every single PLC scan. If you put the PIDs in subroutines then you can call half the routines on the first scan, the other half on the next scan. Group total execution time of all the PIDs will be only slightly longer, but other tasks can get a chance at faster execution. Something to consider for applications where the PLC is busy with other jobs as well. I dont forsee a problem with this approach for slow moving processes (like heating) but would not recommend it for fast processes.

There is no advantage to this if the PLC does not have other tasks besides heating control, or only menial other tasks.
 
Last edited:
Aleric,
The other tasks I would be using would be contact monitoring and timer functions maybe around 40 i/os, maybe I will think of more later.
 
once you get a pid up and running look at how to move the data of different zones in and out.

When you have one running look at the locations of different data for the pid and try something post when you get stuck but give it a shot on your own first.

Drewcrew6
 
Well I now have a PID up and running with Time Proportioning output.

In my test I used a 40w light bulb and a RTD some 1.5" away.

The setup takes 7 mins to reach target temp with no overshoot and I have tuned the PID for what I believe to be optimum settings, My settings are as follows
Smax = 6000
Smin = -2000
SP = -1700
Kc = 1638.3
Ti = 8.6
Td = 1.07
Loop update = 5.00

With the above settings my Scaled Error varies between 0 and 8, I guess that is tighter than need be ?

My timer for TP output is T4:0 do I assume that I would use seperate timers for each PID being T4:1, T4:2 etc.

Your comments would be most gratefull.
 
Last edited:
Greetings Chris,



issue 1: what (if anything) do your Smax and Smin settings represent? ... usually these are chosen as Engineering Units - something along the lines of “degrees C” or “degrees F” ... now there’s nothing really “wrong” with the units that you’ve chosen as long as they work and they make sense to you ... but a setpoint of “-1700” (that’s NEGATIVE 1700) seems a trifle “non-intuitive” for a heating process ...



issue 2: that’s a LOT of Proportional gain ... in other words, your Kc setting is VERY high ... typically we see settings of something like “1.2” or “2.8” or maybe even “14.0” - but “1638”? ... that’s really getting up there ... basically a setting this high makes me think that something about your setup is sort of “unorthodox” ...



issue 3: your Ti setting of “8.6” basically means that it will take almost 9 minutes for your Integral action to “repeat” the action of the Proportional action ... it seems that waiting almost 9 minutes for ANYthing to happen is a long-long time when you’re working with a little “light bulb” heater ...



issue 4: you said that your Scaled Error varies between 0 and 8 ... that’s from a range of “-2000 to 6000” ??? ... as you said, that’s certainly “tighter than need be” ... my question is this, is your PID REALLY in control of your process? ... try this experiment ... set a small fan to blow across your light bulb to simulate placing a load on the system ... does the PID accurately change the CV (output) to maintain the setpoint? ... I’ve got a hunch that as soon as you start placing some demands on your PID, then things are going to get a lot more interesting ... basic idea: if the load on the system never changes, then you probably don’t need PID control in the first place ... analogy: on a dead-level highway, you don’t need cruise-control to keep your car going the desired speed ... a well-calibrated brick placed on the gas pedal will do a perfect job of speed control ... but as soon as you come to a hill, the speed will change ... unless, of course, you have a properly tuned controller (cruise-control/PID) to automatically change the gas pedal setting for you ...



continuing on ... PLEASE do not let anything that I’ve said here discourage you in any way ... you’re on the right track ... by experimenting with this stuff you’ll learn much more than by simply reading a book ... but ... I’ve put in a LOT of time experimenting with different types of “benchtop” processes - including light bulb heaters exactly like the one that you are describing ... and using light bulbs, I’ve had VERY limited success developing a “meaningful” experiment that requires PID control ... basic idea: when you put any reasonable amount of load on the system (ex: air stream from a small fan) then the light bulb doesn’t have enough “horsepower” to overcome the load ... so even though the PID drives the output wide open, it still can’t maintain the setpoint ... so if you want to continue your experiments (and you certainly SHOULD), then make sure that your system is realistic enough to require - and then benefit from - PID control ... the key to this is coming up with a way to vary the “load” on the system (think of the hill on the highway) but still not “overload” it so that the PID can’t possibly compensate for the changing conditions ...



suggestion: it would be a good idea to post your program code ... we’d all be glad to take a look at it for you ... and if your copy of RSLogix has a “trend” feature built in, then a graph of your process’ performance would be VERY helpful ...



and finally ... I understand that your real application seems to be “room temperature control” ... so apparently your “light bulb” system is just an experiment with PID to get you ready for the real thing ... but at some point along the line, you’ll need to move past the “light bulb” system and on to the real task at hand ... basic idea: keep your ultimate goal in mind ... there are so many differences between the two systems that you might end up spinning your wheels on the light bulb - when tackling the room temperature might be more to the point ...



best of luck ...
 
Last edited:
Ron, Since Chris is using an RTD, SMAX 6000 must refer to 600 C and -2000 is -200C in .1C units.

ChrisFlint: Excellent for a first time out. But I agree with Ron, your gains seems to be way out of whack with what I would expect. In addition to changing the load, I also suggest making a sudden step change in the setpoint, and see how it responds. And is that really -170 for the setpoint, or is it a typo. If it really is -170 then you've got something wrong.


Otherwise good job, pat yourself on the back.
 
Last edited:
Thanks Ron & Aleric, all comments are most welcome. The smax and Smin is the RTD range in .1 deg, I must have made a mistake somewhere as the setpoint or -1700 equates to around 55 - 60 degrees c, I do get the correct reading at my MOV command box!

Without the high gain I could not get to the setpoint, Maybe next time I will let it soak at a setpoint then raise the setpoint and measure the deadtime and natural period to workout the settings for PID from there!

I know this is just the start however I do feel a lot more confident now that I have some working code, That's the pat on the back done!!

I will use a small computer fan to cause a disturbance and check out the results, The idea is for me to get conversant with PID then when this is implemented to control the heating the PID setup will be kept to a minimum time frame.

As to if I have built in trend I do not know I am using Rslogix 500 Ver 6.00.00 Build 20. It does have a trend folder and I can click add new, I just do not know how to do this yet!

I have attached the program code which sure can be refined a little!

Keep up the comments please! even negatives are positive.
 
Greetings Chris,



sorry that I’ve only had time to take a quick glance at your code so far ... maybe I’ll have more time later ... but so far it looks like your scaling has MAJOR issues ... you’re using a 1746-NR4 module ... and you’ve selected scaling for “Engineering Units” in a range of “-200 to 600” ... based on what I understand about your system, the “Scale for PID” setting would be a much better selection ... basic idea: the PID for the SLC platform needs its PV reading to arrive in the range of “0 to 16383” ... that’s not happening with your current setup ... I’ll try to find time to work through the math if you need that depth of help ... I’m betting that you can figure it out on your own - now that you know that your input scaling is an issue ...



another thing ... your “first scan” COP which is apparently intended to scale the 1746-NR4 seems to be aimed wrong ... the destination should probably be #O:6.0 for your hardware setup ... don’t let that throw you if you decide to change the scaling configuration ... I’ll double-check this issue later when I have time ... in the meantime, I suggest that you manually type the configuration words right into the module’s datatable locations ... apparently that’s the approach that you used to get this far along ...



I haven’t had time to even glance at your output code yet ... but I wanted to get at least this much to you ...



oops ... gotta go ... phone is ringing again ...
 
Last edited:
Chris,

Here is the program as promised, this was this was version 0.0.1 and will have some bugs and none of the PID loop are tuned but are on the settings I usually start from. If you have trouble with scaling the RTD module then use a SCP block to do the scaling, it is also useful if you need to add a calibration offset. As you can see the airflow conversion was a bit tricky.
 
John,

In rung 8:6 you have the PID entered as
PID N14:0 N14:14 N14:16

You have designated words 14 and 16 of the PID control block as your PV source and your CV output.

I have never seen this done this way. Every example I have seen from AB shows those two pointed at addresses external to the 23 workd PID control block. The word N14:14 is written to by the PID instruction to show the process variable in scaled engineering units scaled according to smin-smax. This entry should be pointed at a different address, such as N14:30 which contains the PV scaled for 0-16383 counts.

The word N14:16 is written to internally by the PID instruction after completion of the calculations with a value between 0 and 100, the % output of the instruction, The address that you enter for the Control Variable will be written to by a value between 0-16383.


I imagine it works OK because these words are for the user's information and you are not overwriting anything essential to the calculation, but I have never seen it done that way, but rather the rung would look something like:
PID N14:0 N14:30 N14:31
It would be preceeded by a SCP with a destination of N14:30 to scale the PV into 0-16383.

Have a look at this tech note:
http://domino.automation.rockwell.com/applications/kb/RAKB.nsf/WebEULA/0/A02E853A8B1B42EE85256D35005B6D2E/?OpenDocument&IAgreeToRockwellAutomationEndUserLicenseAgreement#DataFiles
 
Last edited:
chrisflint,

Comments on the program you posted in message #23...

First 3 rungs, right out of the examples. Looks fine except that the input should be configured for "Data Format = Scaled for PID" like Ron said. I had no problem using the IO Configuration dialog to set this up (not sure what problem Ron had with it).

The last rung is intended to scale the ouput of the PID to 0-4000. I suggest you use a SCP instruction instead. Parameters = 0, 16383, 0, T4:0.PRE, N7:25. This will do what you want, avoids overflow errors, and is easier to understand.

The remaining 3 rungs are the time proportioning output. The timer will work as you have it, but it's more common to put a XIO of the timer DN bit in front of the TON instead of using an XIC of the timer DN to trigger a RES. Also, 40 seconds seems rather long for cycle time using a light bulb, but it's easy to change as you experiment.

I would usually not use a OTL & OTU on a real output. It makes the state retentive (whole other discussion, search for it here). I would suggest using a regular OTE with two conditions: The scaled output N7:25 > 0 and T4:0.PRE < N7:25.

Basically, I think you're only real *mistake* is in the scaling on the input.

One final comment on RTD input cards... I find them not very useful because you can't scale them without losing resolution. If I was using an RTD to measure temperature, I would use an RTD transmitter that puts out a 4-20ma signal. I can set up the transmitter for a 0-100 degC range, and I get full resolution over that range. The RTD input card only gives me 2048 counts instead of 13106 over the same range. 2048 counts is certainly not unusable, but the narrower your range the less resolution you get.

Hope you find this helpful and good luck...

Mike Ellis
 
Last edited:
Alaric said:
John,

In rung 8:6 you have the PID entered as
PID N14:0 N14:14 N14:16

You have designated words 14 and 16 of the PID control block as your PV source and your CV output.

I have never seen this done this way.

Neither have I ! This program was not tested in this form and I don't have a tested version. I am not quite sure what happened here. The address for PV and CV should be Nx:30 and Nx:31 as you suggest. The later versions did work. I may be able to find a later version; my applogies to everyone, however the principle is OK I think.

I agree about the RTD modules they are a pain in the proverbial, much better to use 4-20mA head converters and a NI8 card. I have other posts about this subject and also a simple method of tuning PID loops that is taken from the ML1500 handbook.

I find this emperical method of PID tuning from the Micrologix 1500 manual is quite good. From 1762-rm001e-en-p section 19-23.

http://www.ab.com/manuals/cp/1762-rm001e-en-p.pdf

Another way to do it;

1.Turn off the I and D compnents
2.Set the P component until the process oscillates at its natural period
3.Set the loop update time to 1/10 of the natural period
4.Set the P component to about 1/2 that required for oscillation
5.Adjust P until the process is steady but with a steady state error
6.increase the I component until the steady state error is within limits
7. If external influences cause instability then introduce some D term until the process is stable.

Test using a step test.

Process overshoots - Increase D or reduce I

Process oscillates reduce P

Process under shoots but reaches SP then reduce D

Steady state error - increase I

Response too slow - increase P or I

Bear in mind that changing one parameter will influence the others and depends on the PID equation you are using.

Make only SMALL changes.

Use a graphical recording device such as a chart recorder or TrendX in RSLogix to follow your process and analyse your adjustments

If it will not control then go back and start again, don't persist with adjustments if you loose control of your process.


For slow response systems a D term is not usually necessary so turn it off if you don't need it.


If you have the choice use a purpose built PID controller with auto tuning and fuzzy logic. PID control in PLCs is difficult at best and can be a nightmare.
 
Last edited:
For ChrisFlints applicaction the RTD input module will be more than sufficient. It offers .1 degree resolution - which is tighter resolution than the RTD accuracy.

I suggest three wire RTDs be used to cancel lead wire resistance.
 

Similar Topics

How can I test some PID code I have written for a SLC-500 in RSLogix500, without having an actual processor to test on. I have used Emulate500 to...
Replies
3
Views
1,837
Hello, I have a PID block in my program controlling pump speed in order to get a correct Differential pressure. The way I have it set up is the...
Replies
3
Views
1,265
I have a PID in a SLC 500 that does not function as it should. Have deleted it remade it and still have a problem also moved it up and down in the...
Replies
13
Views
2,752
I am new to the SLC 500 platform and am hoping that someone can give me some hints on how to do PID and ramp/soak with the SLC 500 and perhaps...
Replies
11
Views
6,660
Please Help me to make this PID working. I had done PID according to AB manual but it is not working. when I am manully changing the CV at setup...
Replies
6
Views
7,570
Back
Top Bottom