Using one PID Instruction for several loops.

citizen423

Member
Join Date
Nov 2010
Location
chattanooga
Posts
9
I'm wondering if I can combine several PID loops and control them from one single PID PreDefinedTag. Can I index thru multiple elements of the tag or maybe move arrays in and out of the same PID tag? I'm controlling temp sp in 6 identical chambers with one processor at the same time.

Any advice would save the day right now!!
Thanks!!! (y)
 
Well, that's what I thought I might be avoiding. I'm writing this program that runs several identical units and I want to be able to change the amount of units I'm controlling fairly quickly for the next set. This particular program controls 6 units, the next will be 10, then 5, 4, 12 etc. I believed I could stop the scan to autotune them one at a time if I used indexing. But i'm affraid your dead on it!
 
Citizen,

What software are you using (I am assuming RSLogix5000 here)?

What we have done successfully is create a User-Defined datatype (UDT) that was an array of PID loops. We have a similar situation where we have multiple units each with a PID loop for a given function.

We made the code generic enough so that each unit had it's own instance of whatever function we needed. So for lets say a Pressure Control module, we made a UDT for Pressure Control and embedded the Pressure Control Array of PID loops within the UDT. The code would loop through each unit and also indirectly evaluate the PID loop, so if you made a PID UDT called PressurePID you could do this:

PressurePID [ Unit_Index]

In our case, it was:
CM_PressureControl . PressurePID . [Unit_Index]

You don't have to embed the Pressure PID UDT in another tag, and outside of the control module, independently loop through the PID UDT array for each unit.


Unfortunately when you view the ladder logic, in RSLogix you cannot (as of Rev17) view the Output, PV, SP ,etc from the PID instruction if it is indiretly referenced in the Ladder you would have to either drill down to the PID tag in the tag browser or Edit the rung and replace the unit index with what instance of the PID loop you wanted to look at. You don't have to accept the edits to do this.
 
Last edited:
To directly answer your question:

I wouldn't recommend using one PID instruction for multiple loops. But if you did, a PID instruction in Logix5000 has a CTL element in the data structure you can configure to set up the PID block. You can also write to the process gains (Kp, Ki / Ti, Kd / Td), as well as the min and max CV Output, etc... Check the PID Instruction Help in Logic for more info.

It would be rather cumbersome and potentially confusing (and also could be harmful if not fully tested) to program something to set up the PId block dynamically.

If you have the time and the ability, and absolutely can't do otherwise, then this is possible. Otherwise I recommend making use of a UDT to help you.
 
Yes, I'm currently running v.19.01. You have helped me to verify that my original thoughts would work but as I have been looking further into this I believe this would be a goal for another project. It
 
Don't do it.

Your debugging, monitoring, tracing, understanding will be havoc !

The only way I can see this working effectively is by using Add-On instructions, where you can monitor each instance of the instruction operating.

Without AOIs, program as many PIDs as you need for each project
 
I use the max controlloops as needed in like for me it is max 20 so made 20 loops.
i fill in the numbers on each block, like the Prop, The Int etc.
i put the inputs on it and the outputs.
However you could use a different approach by switching the inputs with a relays and have one loop, however all settings like internal memory should be in an array, to have every loop have its own integration etc.
(btw this is the only one in temp control needed.
 
Citizen: I´ve seen it , but I don´t like it. Basically what they did was to call a subroutine with input and output parameters. They used the PID (ladder instruction), the main problem is troubleshooting.
It´s much better to use a periodic task, create a new program and use a routine for each PID.
 
I suspect that by the time you are done programming, testing, and de-bugging you could easily buy a second rack and power supply to connect to the first one, use it for the extra PIDs, and exchange data over the comm link.

It would probably even be faster to roll your own PID, depending on the PLC you are workinbg with.
 
I'm wondering if I can combine several PID loops and control them from one single PID PreDefinedTag. Can I index thru multiple elements of the tag or maybe move arrays in and out of the same PID tag? I'm controlling temp sp in 6 identical chambers with one processor at the same time.

Any advice would save the day right now!!
Thanks!!! (y)

I agree with the others, it's not going to be easy to maintain or program. If making the program easily scalable is the concern, try setting up standardised blocks using add-on instructions. This will make deployment much easier and likewise troubleshooting.
 
I agree with the others, it's not going to be easy to maintain or program. If making the program easily scalable is the concern, try setting up standardised blocks using add-on instructions. This will make deployment much easier and likewise troubleshooting.

If you can't use the add-on instructions, then just copy/paste a whole subroutine file for each PID control, using a separate instruction for each loop.

What's the hassle, a few minutes entering the JSR's for each controller, no sweat there really.

You could even have 20 JSR's, and just have empty files of the PIDs you don't need.... easy !

So often, people want to make the programming "elegant", at the cost of maintenance
 
Last edited:
I have seen this in a PLC5 you talk about a good one to troubleshoot. I got a call to drive down to theism plant in the middle of nowhere. They had 15 heat/cool loops in 1 PLC. It sucked.

I was on another job and ran into the original programmer after we talked he said that he would never do that again. He was young and fresh out of school when he did that.
 
I have seen this in a PLC5 you talk about a good one to troubleshoot. I got a call to drive down to theism plant in the middle of nowhere. They had 15 heat/cool loops in 1 PLC. It sucked.

I was on another job and ran into the original programmer after we talked he said that he would never do that again. He was young and fresh out of school when he did that.

Like I said
Comme je l'ai dit
Wie ich schon sagte
Como he dicho
就像我說的

sorry, got Google Translate fever, lol
 
Are you guy's saying to put each loop inits own sub? Why may i ask?

Is there anything wrong with having 20 loops on one ladder?

I just seperate each loops code with a couple rungs of dummy / spacer/documentation logic and it is real clean. Never had any issues with it.

That's how it was in several programs here so i just stuck with it.

What is the advantage of 1 loop per sub?
 

Similar Topics

I have a Micrologix 1200 and this is my first attempt to use a PID instruction. I have it "working" but it is extremely slow to reach the...
Replies
17
Views
6,608
I have a burner that uses two fuel sources. Currently we only have one PID tag that runs the fuel controls for the active burner, but if we...
Replies
6
Views
2,147
Hi everyone, I have a problem with EN2TR during I using the EN2TR web page. I was trying to use EN2TR web via connecting thru E-TAP and go thru...
Replies
1
Views
1,247
Is there a way to create proportional logic for a control valve without using a PID function? I want to create a simple P controller without...
Replies
8
Views
2,619
Hi Everyone! My name is Vidy and I am new to PLC AND PLC PROGRAMMING As Part of my final year project I have been tasked to program a PID...
Replies
5
Views
3,022
Back
Top Bottom