You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old January 17th, 2018, 06:32 AM   #1
rta53
Lifetime Supporting Member
United States

rta53 is offline
 
rta53's Avatar
 
Join Date: Feb 2003
Location: North Carolina
Posts: 613
2 PID loops for one control variable

I have a need to control the speed of a pump using two different control scenarios. The hardware is an AB CompactLogix with Studio5000 V30.

Normally the pump is controlled based on the discharge pressure as the control variable with a single set point. However, when a carbon filter is backwashing, they want me to control the pump based on flow as the control variable, with two different set points, one for backwash and one for rinse. I'm guessing I will need to use two PID instructions and enable the appropriate one as needed. What would be the cleanest way to do this?
  Reply With Quote
Old January 17th, 2018, 09:08 AM   #2
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,372
Quote:
Originally Posted by rta53 View Post
I have a need to control the speed of a pump using two different control scenarios. The hardware is an AB CompactLogix with Studio5000 V30.

Normally the pump is controlled based on the discharge pressure as the control variable with a single set point. However, when a carbon filter is backwashing, they want me to control the pump based on flow as the control variable, with two different set points, one for backwash and one for rinse. I'm guessing I will need to use two PID instructions and enable the appropriate one as needed. What would be the cleanest way to do this?
To be honest I think you have answered your own question - "I'm guessing I will need to use two PID instructions and enable the appropriate one as needed".

The only issue you will have is that both PIDs cannot control the same output, as one will be at zero (disabled), while the other will be controlling, so use your "enable" bits to move the respective output from separate holding registers.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 17th, 2018, 09:37 AM   #3
rta53
Lifetime Supporting Member
United States

rta53 is offline
 
rta53's Avatar
 
Join Date: Feb 2003
Location: North Carolina
Posts: 613
Quote:
Originally Posted by daba View Post
To be honest I think you have answered your own question - "I'm guessing I will need to use two PID instructions and enable the appropriate one as needed".

The only issue you will have is that both PIDs cannot control the same output, as one will be at zero (disabled), while the other will be controlling, so use your "enable" bits to move the respective output from separate holding registers.
Would you not be able to use the same analog output as long as only one PID is enabled at a time?
  Reply With Quote
Old January 17th, 2018, 10:04 AM   #4
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,372
Quote:
Originally Posted by rta53 View Post
Would you not be able to use the same analog output as long as only one PID is enabled at a time?
Sure, but don't specify the output in both loops. You need intermediary tags which you copy to the output depending on which loop is operating.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 17th, 2018, 10:12 AM   #5
Kevbo
Member
United States

Kevbo is offline
 
Join Date: Aug 2006
Location: Albuquerque,NM
Posts: 27
Another suggestion: Use an int to select which loop is active, NOT two booleans.

Why?

Because sure as anything, next year when you (or the next guy) have to modify the code, you will make an error which will result in both booleans being true at the same time.

If you use an integer, then it can only be one or the other (or the third if you need to add another mode) and you never accidently get both loops active at the same time.
  Reply With Quote
Old January 17th, 2018, 10:22 AM   #6
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,372
Quote:
Originally Posted by Kevbo View Post
Another suggestion: Use an int to select which loop is active, NOT two booleans.

Why?

Because sure as anything, next year when you (or the next guy) have to modify the code, you will make an error which will result in both booleans being true at the same time.

If you use an integer, then it can only be one or the other (or the third if you need to add another mode) and you never accidently get both loops active at the same time.
Use a DINT - more efficient.

Logix5000 are 32-bit machines, so using any other data-type results in conversion to DINT for processing, and conversion back again for storing the result.

It may seem odd to use a DINT when you only want the values 0 & 1 (or 1 & 2), but it really is most efficient to do this.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 17th, 2018, 10:22 AM   #7
Mickey
Lifetime Supporting Member
United States

Mickey is offline
 
Mickey's Avatar
 
Join Date: May 2003
Location: Palmdale,Ca
Posts: 10,088
Quote:
Originally Posted by Kevbo View Post
Another suggestion: Use an int to select which loop is active, NOT two booleans.

Why?

Because sure as anything, next year when you (or the next guy) have to modify the code, you will make an error which will result in both booleans being true at the same time.

If you use an integer, then it can only be one or the other (or the third if you need to add another mode) and you never accidently get both loops active at the same time.

You only need one...

--| |--

--|/|--

The problem is the trasnsistion between the two PID's. You will need some logic to smooth out the output from PID to the other.
You don't want the output to jump from say 0 to 100 % or something inbetween.


Maybe controlling the PIDs auto/manual modes. Then have the manual PID's setpoint track its process. Then after the transistion to auto slowly change its setpoint to whatever is required. (just thinking out loud)
__________________
Mickey

If you want happiness for an hour-take a nap. If you want happiness for a day-go fishing. If you want happiness for a month-getmarried. If you want happiness for a year-inherit a fortune. If you want happiness for a lifetime-help someone else.
----- Chinese Proverb

Last edited by Mickey; January 17th, 2018 at 10:36 AM.
  Reply With Quote
Old January 17th, 2018, 10:34 AM   #8
Tom Jenkins
Lifetime Supporting Member
United States

Tom Jenkins is online now
 
Tom Jenkins's Avatar
 
Join Date: Apr 2002
Location: Milwaukee, WI
Posts: 5,881
Actually, you only need one PI (or maybe PID) for the pump. You need two surces of setpoints for that PI loop - either a fixed flow setpoint or the output from a cascaded pressure control loop.

Pumps produce flow. The piping system creates resistance to flow that creates the pressure the pump has to overcome to move that flow through the system. When you modulate the pump, either by throttling the discharge or varying pump speed, you are essentially changing pump flow and the interaction between the flow and the system restriction.

So, I recommend you have a pump flow control loop. It will have three different setpoints:
1) The required flow during backwash
2) The required flow during rinse
3) The output from a separate PI (or PID) loop that uses pressure as the process variable and flow rate as the manipulated variable. This loop will be locked out during filter backwash and rinse cycles.
  Reply With Quote
Old January 17th, 2018, 10:36 AM   #9
Kevbo
Member
United States

Kevbo is offline
 
Join Date: Aug 2006
Location: Albuquerque,NM
Posts: 27
Quote:
Originally Posted by daba View Post
Use a DINT - more efficient.
Ah, thats a nice refinement...no experience with that particular PLC.
  Reply With Quote
Old January 17th, 2018, 10:41 AM   #10
rta53
Lifetime Supporting Member
United States

rta53 is offline
 
rta53's Avatar
 
Join Date: Feb 2003
Location: North Carolina
Posts: 613
Quote:
Originally Posted by Kevbo View Post
Ah, thats a nice refinement...no experience with that particular PLC.
Yes thanks for pointing that out. I do typically use DINTs.
  Reply With Quote
Old January 17th, 2018, 10:41 AM   #11
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,372
Quote:
Originally Posted by Tom Jenkins View Post
Actually, you only need one PI (or maybe PID) for the pump. You need two surces of setpoints for that PI loop - either a fixed flow setpoint or the output from a cascaded pressure control loop.

Pumps produce flow. The piping system creates resistance to flow that creates the pressure the pump has to overcome to move that flow through the system. When you modulate the pump, either by throttling the discharge or varying pump speed, you are essentially changing pump flow and the interaction between the flow and the system restriction.

So, I recommend you have a pump flow control loop. It will have three different setpoints:
1) The required flow during backwash
2) The required flow during rinse
3) The output from a separate PI (or PID) loop that uses pressure as the process variable and flow rate as the manipulated variable. This loop will be locked out during filter backwash and rinse cycles.
Of course you could do it with just one control loop, but then you'd have a plethora of data moves, setpoints, P, I, & D terms etc., and that will make the system hard to maintain, because you'd have to edit the relevant sources of that data, not the values set in the PID instruction tag. And if you were loop tuning, those data moves would have to be continuous, or they wouldn't get into the PID tag.

I just think it's easier, tidier, and clearer to an onlooker, to have two independent loops that can be tuned separately.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 17th, 2018, 10:46 AM   #12
rta53
Lifetime Supporting Member
United States

rta53 is offline
 
rta53's Avatar
 
Join Date: Feb 2003
Location: North Carolina
Posts: 613
On a totally side note. I laughed when I noticed the avatar I've been using all these years.(Became a member in 2003) My hair was still brown back then so that avatar seemed appropriate. No longer...I have practically no brown left, although I do still have a good bit of hair.
  Reply With Quote
Old January 17th, 2018, 10:54 AM   #13
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,372
In the case you mentioned in the OP, I would probably have 3 PID loop instructions, each with their own PID tags, Process, Backwash, and Rinse, enabling them as required at the relevant stages. Each loop could then be tuned independently, to cater for any different flow characteristics.

I don't see transitions between modes being an issue, surely there would be some "dead-time" between Process and Backwash, and between Backwash and Rinse, so each loop would be firing up in isolation.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 17th, 2018, 11:16 AM   #14
rta53
Lifetime Supporting Member
United States

rta53 is offline
 
rta53's Avatar
 
Join Date: Feb 2003
Location: North Carolina
Posts: 613
Quote:
Originally Posted by daba View Post
In the case you mentioned in the OP, I would probably have 3 PID loop instructions, each with their own PID tags, Process, Backwash, and Rinse, enabling them as required at the relevant stages. Each loop could then be tuned independently, to cater for any different flow characteristics.

I don't see transitions between modes being an issue, surely there would be some "dead-time" between Process and Backwash, and between Backwash and Rinse, so each loop would be firing up in isolation.
Sounds like the best solution! I think this will do exactly what I need. Thanks!
  Reply With Quote
Old January 17th, 2018, 11:31 AM   #15
Paully's5.0
Lifetime Supporting Member
United States

Paully's5.0 is offline
 
Join Date: Jan 2006
Location: WI
Posts: 2,022
Quote:
Originally Posted by Tom Jenkins View Post
Pumps produce flow. The piping system creates resistance to flow that creates the pressure the pump has to overcome to move that flow through the system. When you modulate the pump, either by throttling the discharge or varying pump speed, you are essentially changing pump flow and the interaction between the flow and the system restriction.
By the sounds of it, OP is programming some type of filtration system. So the membranes will have an impact on pressure in the line, and it's probably ideal to run at an optimum pressure specific to the membrane during production rather than flow through the membrane. As the membranes get clogged up flow will be reduced and pressure will increase, so it's better maintain a constant pressure than flow.

When backwashing it all changes, flow is required to get things cleaned out.

In a previous life I worked on filtration systems, and typically it goes something like this:

1 - Pressure PID in control
2 - Pressure PID in manual (maintain fixed output, bump less transfer to flow PID)
3 - Flow PID in control
4 - Reverse to go back (don't forget the bumpless transfer.

The issue is ensuring the output to the pump doesn't suddenly drop or spike as you transition from one control loop to the other (on a running system). You need logic in place to perform a bumpless transfer between the PID loops, which usually means some intermediary storage tags as Daba mentioned and logic to keep track of it all.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Please help settle a debate about P and PI control loops defcon.klaxon LIVE PLC Questions And Answers 7 January 22nd, 2016 01:38 PM
[Logix] Lead/lag pumps with PID control and auto/manual speed setpoints defcon.klaxon LIVE PLC Questions And Answers 12 December 10th, 2015 05:18 PM
Centrifugal Blower PID Control justin lutz LIVE PLC Questions And Answers 5 November 19th, 2013 03:28 AM
Modicon PID Loops rgive LIVE PLC Questions And Answers 6 August 25th, 2009 03:20 PM
PID Control With S7 Unregistered LIVE PLC Questions And Answers 2 May 30th, 2005 10:43 AM


All times are GMT -5. The time now is 08:20 AM.


.