PID tuning woes

mobil1syn

Lifetime Supporting Member
Join Date
Dec 2018
Location
socal
Posts
79
so i have 4 25gpm wells feeding a 1000gal tank (T-1), with an additional 15gpm from a decant tank for 3hrs every 12hrs.

P1 and P2 both controlled by powerflex 525
P1 flow min is 50gpm (30hz), max 125gpm (51hz)
P2 flow min is 65gpm (30hz), max 140gpm (54hz)
PID loop is being driven by the PLC (control logix l33er)

T-1 level is the control setpoint, with is 2.5 with an overall tank height of 5. previously we had 2 of the wells flowing to T-1 and i was able to get the loop dialed in with PI and P-1 would vary a few gpm.

P-2 i could never get under control, now with 4 wells going and the decant flow, P-1 flow it is all over the place, which cascades to T-2.

process 1 doesnt care much about fluctuation in flow. the sand filter DP is really sensitive to flow and process 2 is sensitive to flow as well.

the OEM i work for provided process 1. we won the contract for operations, which was supposed to be turnkey at the time of handoff, but was not even close as it typically is. i now have access to the PLC, so i can start trending things. dont have much lead way in what i can do from a logic standpoint because politics.

so after messing with PI setting, i am not getting the results i need.

after lots of reading, D still doesnt 100% make sense in my head so im hesitant to go that direction.

i found a thread where a guy was having issues and ended up cutting down the accel/decel time from 10s to 1s and it helped get his issue sorted out.

so my questions
- am i expecting to much control from the pump with the retention time in the tank being so low?
- if the accel/decel time is 10s from 0 to 60hz, does that apply only on start up or does that linear relationship apply to all adjustments in speed?
- it doesnt appear that a lot of people use D, when would you apply that?

Untitled.jpg
 
How tight must the levels be maintained?
What are the flows for pump 1 and 2?

You don't need derivative gain for tank level control if you can live with some tolerances. Use a proportional band and NO INTEGRATOR at first.
The trick is to setup the proportional band so the flow is 115 gpm, the inflow, at set point.



T-1 is 200 gal/ft. Given that the flow into the tank is only 115 gpm it would take almost 2 minutes for the level to change 1 ft. That is pretty slow. I don't think that changing the acceleration/deceleration time will make much difference if using only a proportional band. However, if you use an integrator then the integrator is winding up or down while the pumps are accelerating or decelerating and not at the set point. The set point is 2.5 ft but what is the tolerance? Eventually pump one will need to pump 115 gpm so the outflow matches the inflow when at steady state.The same goes for pump2. T-2 needs about 400+ gal/ft. at 115 gpm it will take almost 4 minutes to change 1 ft.

I can see big problems with the integrator winding up if the integrator time constants are too short. I would just use a proportional band on both tanks for starters. For tank 1 have the band be 2.5-0.25 for off and to 2.5+.25 for full on. I would do something similar for pump 2. The trick is that the flow should be 115 gpm when at the set point. So if pump 1 and 2 provided 230 gpm then the proportional band should be symmetric around the set point. If the pumps pump only 200 gpm then the proportional band needs to be offset to start pumping at a lower threshold. I will leave the math to you.
 
Peter's approach of a P- only gain is very similar to what I do for the majority of these balance tank type problems. I don't even use PI controllers, I just use a linear scale function between minimum desired tank level and maximum level. The output of this linear scaling is a flow setpoint for my supply pump (s). I.e. at minimum acceptable tank level, flow setpoint = max flow. At maximum level, flow setpoint = minimum flow.

In my case each well pump always has its own flowmeter, so I have a PI controller running for each pump which takes the flow setpoint from the tank controller and uses this to regulate pump speed to achieve the flow rate. This is always a much faster loop and a lot easier to tune.

What controls Pump 1s speed, or is it fixed speed? If all is working well with the above way of controlling the well pumps, then the flow rate out of the tank from pump 1 will eventually match the combined well pump flows. The tank level will vary as this rate changes, but generally the level in the tank is not the important thing, it's keeping flow consistent and stable.

Everyone gets so focused on maintaining a constant tank level when the whole point of the tank is to be a buffer. Even the consultants who design the system... had one guy argue with me because the tank level wasn't sitting at operator adjustable setpoint", even though the flows in and out were perfectly stable. Asked him which one he wanted, because he couldn't have both
 
Due to the lack of information, I can not argue with the 2 posts above.

But I suppose we're trying to solve the wrong problem.

Waiting for trends
 
Waiting for trends


+1

  • What is the character (flow variation over time) of the wells' inflows feeding the first tank?
  • How much noise is in the level signals?
  • What are the target level specifications? 2.5' ± what? 3.3' ± what?
  • How fast can the pump speeds be ramped up and down?
  • How non-linear are the relationships between Hz and gpm?
  • Do variations in Process 1 and/or the Sand Filter and/or Process 2 change the back pressure at the pumps' discharges over time?
I ask those questions, but as @Peter Nachtwey notes, the process is so slow that none of them probably matter.

This process should be trivial to simulate; most of the code would be dedicated to modeling process variation and sensor noise.
 
Last edited:
Also, to restate what @Saffa said, and something that perhaps goes without saying, but just to make sure it is understood as an absolute and unchangeable characteristic of this process:
There are only two possible control objective endpoints for managing the flow through this system:

  1. Maintain tank levels' control as tight as possible, and pass any inflow changes* to the downstream processes** as near instantaneously as possible.
  2. Allow tank levels to fluctuate in order to attenuate the instantaneous acceleration of flow rates to the downstream processes.
The more the tank levels can be allowed to vary, the greater the attenuation of flow rate changes is possible, and vice versa.

Stated negatively and more bluntly, the pumped flow rates and levels in this system cannot be independently controlled.

If there are specifications for the maximum variation over time in flow rates to the downstream processes, then that necessarily sets the minimum variation in tank levels that must be tolerated/allowed.

* from the wells and decant
** Process 1 and to the Sand Filter and to Process 2
 
Stated negatively and more bluntly, the pumped flow rates and levels in this system cannot be independently controlled.
I said that above. The inflows and outflows must be equal to maintain level.
The simple proportional band is the simplest way to control the levels within some level band. However, things get MUCH trickier if P2 must pump at a certain minimum or maximum rate. Then PI might need to pump a little faster than 115 gpm to keep T2's level from dropping too low.

If I were doing it I would let the "PID" part control to a SP and the pump 1 and pump2 would use the inflow as a bias. P1's bias should allays be 115 gpm but P2's bias would always be P1's flow. However, this requires know what P1 doing and there is no mention of that.
Changing P2's bias as a function of P1's speed satisfies what DrBitBoy said. This also requires that the "PID" be bi-polar so when the level is less than the set point, the pumps can be off due to the "PID" part off seting the bias. If the OP gets this far then a little integrator would help. I can calculate this down to 3 decimal places of if I have the information.

The big problem is the integrator. Most "PID"s do not implement the anti wind up well if at all. I have videos that show how to do this SIMPLY if you write your own "PID".

However, adding the integrator is ONLY NECESSARY IF PRECISE LEVEL CONTROL IS REQUIRED. if not then forget it.

Here is a question for the form. What is the gain of the tanks? Tanks do have a gain.

If you want to get very tricky, use a LQR but I think that is OVERKILL. LQR is where you define a cost function which would allow you to provide a weight for the error in the level for each tank and possibly a mismatch between P2's outflow and the required outflow for the rest of the process.

Stick to the simple proportional bands if possible.
 
One more piece of info that might be needed: is there the possibility of any net accumulation of fluid in any of Process 1, Sand Filter, or Process 2?
 
From OP:

process 1 doesnt care much about fluctuation in flow. the sand filter DP is really sensitive to flow and process 2 is sensitive to flow as well.

Perhaps the best thing to do would be to use the combined capacitance of both tanks to minimize flow variation on pump 2.

Interesting problem, but I think we need to more about the character of the flows over time.
 
For example, if pump 1 speed is controlled with proportional-only feedback based on tank 1 level, then tank 1 level becomes a filtered proxy for total inflow, which proxy could be scaled and used as the bias to pump 2 speed, so pump 2 usually moves (drifts?) toward the inflow. That would take a lot of modeling though, which may not be possible politically.
 
For example, if pump 1 speed is controlled with proportional-only feedback based on tank 1 level, then tank 1 level becomes a filtered proxy for total inflow, which proxy could be scaled and used as the bias to pump 2 speed, so pump 2 usually moves (drifts?) toward the inflow. That would take a lot of modeling though, which may not be possible politically.
But we know the gain of tanks 1 and 2. We know tank 1 is purely an integrating device with no time constant so it can be modeled easily. We don't know about pumps 1 and two but if you assume the pumps can ramp up and down quickly then you can assume they don't have a time constant. The question is what is happening down stream of tank 2 and what are the pumps capable of.
This should be easy.
 
the control philosophy is using tank level for flow control. im am just an operator, i have access to the logic, but do not have the ability to make changes to it. in passing i mentioned changing the control philosophy to the engineer who designed the plant and got push back. so i am going to spend some time trying to get there, if not ill let him know he needs to get someone smarter in here.

How tight must the levels be maintained?
What are the flows for pump 1 and 2?

levels dont 'matter' per say, flow has more of an effect on down stream process 2, which is a UV system.

ideally the flow of p1=p2, so 100gpm unless decanting then 115gpm.

i tried just using the proportional but it wouldnt react or it would react erratically causing the UV to trip.

But I suppose we're trying to solve the wrong problem.

i think that is really the crux of the issue, the UV system that is hyper sensitive to INCREASE in flow, so im attempting to keep flow stable with tight tank level control.

i need to get t1/p1 to be tight and stable so it doesnt cascade to t2/p2.

Stated negatively and more bluntly, the pumped flow rates and levels in this system cannot be independently controlled.

correct, this is source of my woes

If there are specifications for the maximum variation over time in flow rates to the downstream processes, then that necessarily sets the minimum variation in tank levels that must be tolerated/allowed.

and this is what i am struggling to wrap my head around as no one can give me a gpm fluctuation that is acceptable, so trial and error with system trips is the name of the game at this point.

was able to get p1 stable today, will work on p2 tomorrow
t1 level control 2.3ft +/- .15 based on the trend
p1 flow 105gpm +/- 5

p_100.jpg p100_pid.jpg
 

Similar Topics

Hello, I am attempting to tune a PID loop on a process. The process involves a valve with electronic actuator that has quite a high deadband...
Replies
10
Views
2,196
Hi everyone, yet another PID problem. I'm hoping I understand enough of the process I'm controlling that my request for help is reasonable. If a...
Replies
113
Views
28,191
A few months ago, I started to look into PID controllers and the tuning of first order processes. This has, partly thanks to you, resulted in a...
Replies
162
Views
62,470
I haven't had to tune a PID loop in a very long time. It's actually a PI loop for a pulse width modulation s.v. What was the name of that tuning...
Replies
16
Views
4,120
Hello, there is anyone who have already used hpmont plc? now i am programming for that plc and have " pid autotuning is not working" issue. I have...
Replies
0
Views
980
Back
Top Bottom