Logix 5000 PID Instruction in a COntinuous Task

plcnovel

Member
Join Date
Feb 2006
Location
LHR
Posts
215
Hi All
Is it ok, to have bunch of pid instructions in a continuous task? I have read on this forum in some of the posts that there are two ways of define a pid instruction in COntrol logix enviornment:

1) Ideally, use a periodic task
2) Use a timer to generate a clock pulse at the desired interval.

I have a project where i am using about 30 pid instructions in a continous task, but there is no timer which is generating a pusle to trigger these instructions. They all have the same Loop update time etc. The complicated part is i am not using pid in ladder logic, instead i am using it in a structured text and my pid instruction is in a for loop, whose index is representing a new pid. For example, PID[1], PID[2], etc etc.....

Do i have to do any changes to my existing system....or it would be fine. How critical it is to trigger the pid instruction after a specific time, if it is not in periodic task?

Your feedback will be appreciated

Thanks
 
If you are using the PIDE it really should be in a periodic task.
If you are using the PID it works like the PID in the PLC5, NOT LIKE the PID in the SLC. It must be on a conditioned rung or in the case of ST, in a ST construct that will execute only on a periodic trigger.

If you are used to programming in the SLC and have never programmed a PLC5 then you are probably used to putting your PID on an unconditoned rung and setting an update interval. Forget all about that for the PLC5 and the ControlLogix PID instruction. It requires a trigger if it is not in a periodic task.

You will get better PID performance if you can place it in a periodic task. Generally, the more consistent your execution, the more consistent your results.
 
Alaric said:
If you are using the PIDE it really should be in a periodic task.
If you are using the PID it works like the PID in the PLC5, NOT LIKE the PID in the SLC. It must be on a conditioned rung or in the case of ST, in a ST construct that will execute only on a periodic trigger.

If you are used to programming in the SLC and have never programmed a PLC5 then you are probably used to putting your PID on an unconditoned rung and setting an update interval. Forget all about that for the PLC5 and the ControlLogix PID instruction. It requires a trigger if it is not in a periodic task.

You will get better PID performance if you can place it in a periodic task. Generally, the more consistent your execution, the more consistent your results.

Hi Alaric
They way i am using PID instruction in Structured text is as follows:

In the main routine, i am JSR to (PID, which is a structured text routine), and inside this routine i have a for loop to start this routine (from 1 to PID_MAX)with, after assigning all the ranges and stuff, i am calling the PID instruction as follows:


IF PID.ENB = 1 THEN
PID(PID.PID,PID.PV,0,fTMP1,0,0,0);
PID.RLIMIT.IN := fTMP1;
RLIM(PID.RLIMIT);
PID.CV := PID.RLIMIT.OUT;
AO[k].DATA := PID.CV;
ELSE
PID.PID.EN := 0;
END_IF;

SO it seems like i am not triggering my PID instruction at all....can u put some comments on it please

Thanks
 
From the Help file the syntax is:

Structured Text
PID(PID,ProcessVariable,Tieback,ControlVariable,PIDMasterLoop,InHoldBit,InHoldValue);

Which means that your second line will execute the PID provided that PID.PID is of datatype PID and all the other datatypes are correct.

I don't usually get dogmatic about PLC code but PID/PIDE in ControlLogix is one of the few cases where I do. As already stated you'll get better performance from PID/PIDE when it's executed at a consistent rate. Putting the instruction in a periodic task is more (usually much more) consistent than relying on PLC loop time and more consistent than timers, especially timers in the single-figure millisecond range. If you're working with slow loops then you may neither need nor notice the better level of control but it's also so easy to put existing code into a periodic task (click-drag-drop-tell the boss that you'll have it done by lunch)that I just don't see any good reason not to do it. Of course the Forum may have other ideas....
 
So Can i just cut and paste my PID structured text routine in a new periodic task and set the task scan time to something or equal to the Loop update time. Or do i have to create this code from scratch (i mean in ladder logic, one pid instruction for every loop) Thanks in advance
 
You can cut and paste the code to a periodic task. Any locally scoped tags will also need to be copied over. Make sure you give the periodic task a higher priority than the continuous task so that it will complete the entire loop without interruption.
 
Alaric said:
You can cut and paste the code to a periodic task. Any locally scoped tags will also need to be copied over. Make sure you give the periodic task a higher priority than the continuous task so that it will complete the entire loop without interruption.

Hi Alaric
Thanks for your input. What about the period of the periodic task. Can i set it to loop update time (0.25) or do i have to set it to some other number. Most of my PID loops are Pressure, temperature and few of them are flow loops. Is there any specific number i need to use for periodic task scan time?
 
Make the task period equal to your desired loop rate. As for a recommendation of what that rate should be, that will depend on your process, its not something that I can tell you based on the information you have provided. One thing that concerns me a bit is that all of your loops have the same update rate yet they are controlling different kinds of process variables. You might be just fine like that, but IME, the loop update rate is determined by the process response. If everything works already on that update rate then fine, its just not what I would expect to see.
 
Alaric said:
Make the task period equal to your desired loop rate. As for a recommendation of what that rate should be, that will depend on your process, its not something that I can tell you based on the information you have provided. One thing that concerns me a bit is that all of your loops have the same update rate yet they are controlling different kinds of process variables. You might be just fine like that, but IME, the loop update rate is determined by the process response. If everything works already on that update rate then fine, its just not what I would expect to see.

Right now all the loops are working just fine with the same Loop update time. Your statement "Make the task period equal to your desired loop rate" is true only if all the loops have the same loop update time. Lets say if i put different loop update time in different pids then how would my task period will effect, do i have to change my task period (make it equal or greater than the highest loop update time of the pid)? Thats the only confusion i am having right now?

Your comments will be apreciated highly thanks in advance
 
Many people will say that your PID loop update rate should be set 10 times faster than you plant first order time constant. Setting the loop update rate slower than this makes the loop progressively harder to control until it is completely uncontrollable. Setting the loop update longer than this doesn't hurt any but it wastes processing power that could be used elsewhere.

The moral of the story is that you can either optimise multiple periodic tasks and call one PID from each task OR you can set one periodic task to 10 times your fastest process and let the other loops update faster than they need to. Unless you are seriously strapped for processing power I would opt for the second choice.

Keith
 
The moral of the story is that you can either optimise multiple periodic tasks and call one PID from each task OR you can set one periodic task to 10 times your fastest process and let the other loops update faster than they need to. Unless you are seriously strapped for processing power I would opt for the second choice.

Spot on. The only thing that I'd add is that you may want to put each of your PID/PIDE's into a separate Program within the "X 10" Task for legibility and to get the potential benefit of Program-Scoped tags.
 
Something in the middle?

I would set up a periodic task for each type of loop, then set the update time for each group based on the one loop needing the fastest time.
One task for flow loops, one task for temp. loops, one task for pressure loops.
 
Ken Moore said:
I would set up a periodic task for each type of loop, then set the update time for each group based on the one loop needing the fastest time.
One task for flow loops, one task for temp. loops, one task for pressure loops.

So basically you are saying that

TASK 1 FLOW LOOPs TASK 1 Period (fastest UPD among flow loops)
TASK 2 Temp LOOPs TASK 2 Period (fastest UPD among temp loops)
TASK 3 PRS LOOPs TASK 3 Period (fastest UPD among prs loops)

Thanks
 
The 3-Task model will work but the reason that I prefer Keith's structure is that in a 3-Task system the tasks will interrupt each other (based on the other Task property, Priority) which may, depending on the periods you pick and the execution time of the Programs in each Task, cause an unacceptable variation in that consistent timing that we're trying to achieve.

As I said before, it's a trivial task to put the same Programs into different Tasks; you could very easily try both methods and see which one gives the better results.

Either method should work; having sold you on the idea of PID's in Periodic Tasks as opposed to the Continuous Task I'm no longer in dogmatic mode! ☯
 
Ok Guys

I was reading some of the post of Ron Beaufort regarding how often we need to trigger the Control Logix PID. In order to select the loop update time period, do i have to calculate the natural time period of the loop? Lets say i calculate the natural time period of the loop and from there found out the loop update time. Now lets assume i have 10 pids in a periodic task, lets further assume that the loop update time for the 10 pids are as follows:

PID 1 = 1 Sec
PID 2 = 1.15 Sec
PID 3 = .5 Sec
PID 4 = 0.25 Sec
PID 5 = 0.45 Sec
PID 6 = 1.45 Sec
PID 7 = 3.4 Sec
PID 8 = 1.5 Sec
PID 9 = 1.9 Sec
PID 10 = 1.8 Sec

All these loops are in a one periodic task, what should my periodic task period would be? Would it be equal to the highest loop update time or something different? Is there anyway i can calculate my loop update time faster, like some hit n error method, or based on process being controlled? Your comments will highly be appreciated. Thanks in advance
 

Similar Topics

Hello all, I'm having issues with a PID and trying to tune it. I just do not understand why my CV goes to 105 with the settings I have. Config...
Replies
14
Views
1,521
Hi, Long time not in the forum, and not in the programming. I´m getting back. I was issued a conversion from RSLogix 500 to RSLogix 5000 (studio...
Replies
0
Views
1,277
So I have a PID loop on an 1756-L61 running V17 software just for background. Also the PID PV is a pressure transmitter and the CV is speed sent...
Replies
1
Views
863
Hi all, I'm working on a wastewater plant with oxidation ditch aerators. The aerators are on VFDs and the operators want the dissolved oxygen in...
Replies
45
Views
17,412
Hi All, I have a PID control application that I would like to get your opinions on. As I am reality new to PID loops I am struggling somewhat...
Replies
14
Views
4,217
Back
Top Bottom