# PID fighting each other

#### JSan

Greetings,
I have a setup where a Siemens PLC controls two PIDs: one for VFD speed maintaining flow at 360 gpm and a PCV controlling a recirculation valve back to the supply tank to maintain system header pressure at 90 psig. They are individual loops and wondering what is the standard to avoid them fighting each other.

#### ControlsGuy25

Greetings,

Can you share a process flow diagram like this one ...

And then we can have a better overview of the insatllation..and then we can advise ...

Any time!
ControlsGuy25

#### pnachtwey

It is almost impossible to control to both set points simultaneously. One method would be to use LQC ( linear quadratic control ) where there is a cost function that is minimized. The cost function is a weighted function based on the pressure and flow error. You must decide on how much the pressure errors costs per psig vs how much the flow error costs per GPM. Proportional only will do well enough.

Another way to is to use two PI controllers and modify the pressure set point by the error in the flow and likewise modify the error in the flow set point by the error in pressure. Neither real set point ( 90 psig or 360 gpm ) will be reached. The process should reach a stead state at lower process value but you will obtain a nice compromise based on how you modify the set points for the pressure and flow PI only controllers. This is the easy way. The LQC method is probably better but it takes some math. In both cases it will be a judgement or SWAG about the weightings.

So there are two desired set point ( 90 psig and 360 gpm ) and two compromise set points based on how much you reduce each set point based on the error, the real error, in the other's process value. You optimize this by trial and error. Note, it may be easier to start with P only controllers and both set points can't be obtained simultaneously, the integrators may not be that helpful anyway.

#### JSan

Thank you. Not sure how to implement LQC in TIA portal. Here is simplified process diagram

#### Fil

Hi,
Are you sure the flow meter is installed upstream of the recirculation line tie-in point (in the present case you do not control the flow rate to the system) ?
If you want to prevent the two loops from fighting each other, you should tune them so that one is slow acting compared to the second one.
Regards

#### Hilton

Greetings,
I have a setup where a Siemens PLC controls two PIDs: one for VFD speed maintaining flow at 360 gpm and a PCV controlling a recirculation valve back to the supply tank to maintain system header pressure at 90 psig. They are individual loops and wondering what is the standard to avoid them fighting each other.
The easiest way to decouple the two loops is to use the lambda tuning method. There are several descriptions of this method online . The strategy is to tune the flow loop using the lambda method then tune the pressure loop using the same method but assign the pressure loop a lambda (response time) value 10 times the response time of the flow loop. This will immediately solve the interaction between the two.

#### Hilton

The easiest way to decouple the two loops is to use the lambda tuning method. There are several descriptions of this method online . The strategy is to tune the flow loop using the lambda method then tune the pressure loop using the same method but assign the pressure loop a lambda (response time) value 10 times the response time of the flow loop. This will immediately solve the interaction between the two.
Add to my reply I made the assumption that the flow loop is the critical loop, if the pressure loop is the more critical then tune it first using the lambda method then tune the flow loop 10 times slower.

#### pnachtwey

Lambda tuning AKA pole placement will not solve this problem. I am a big believer in pole placement but there are two conflicting goals in this application. A compromise is needed since it is rare that both set points can be met at the same time.
A low select may work. This is where the minimum output of two PID is used. Rockwell PID support low select. With Siemens you need to write the code yourself. It isn't hard but you need to understand the problem.

#### prox

I would recommend VFD controlling pressure and valve controlling minimal flow, to avoid pump damage. This is the typical control, and there is no point and it is a waste of energy to control constant flow to a recirculation (is this flow SP the minimal flow recommended for the pump?).
To detach the controllers, you put valve opening as feedforward to pump controller, when valve opens you anticipate accelerating the VFD proportionally to keep the pressure and cancel the fighting. You can calculate this proportion from valve and pump curves, or you simply tune this gain from the response during operation.