PID tuning woes

Ah, the ol "design engineer" who "designs" things but is nowhere to be seen when there are problems while the operator has to try and make the plant work. See way too many of these situations. I am very blunt and have no patience for that kind of nonsense, I would be straight onto whoever he reports to. These things should have been solved during commissioning, whoever did the automation should still be there sorting this out.

Looking at the trend, it might appear stable because it's "consistent", but it is in fact oscillating. The loop will easily become unstable if anything changes, i.e. you have to reduce flow rate while a well pump is offline or whatever.

The "I" gain is doing all the work here, with a half second loop update time and a relatively slow process, the integral is dominating the control action. A P gain of 1, for a tank measurement of feet, is going to be miles off. I'm one of those savages who couldn't model a pair of sneakers let alone a first or second order process to get the controller gains so i can't tell you the right answer without trial and error, but i can tell you that it isn't 1.0

If i was doing the controls for this this plant, desired flowrate would be set for Pump 2 and controlled on a tight PI loop using flow only.

Tank 2s level would be used to derive a flow setpoint for Pump 1, using a scaling function with min / max flow, and tank min / max level.

Tank 1s level would be used in the same way to derive a flow setpoint for the well pumps.

If T2s level drops below a minimum level then trim the flow setpoint for Pump 2. Same for Pump 1 and Tank 1.

I think you're pushing the proverbial uphill with only being able to change PI gains.
 
I mentioned feed forwards/bias above but no one listens.

Integrators are not necessary unless precise level control is required. The integrators will a cause problems integrator up and down and cause a more oscillitory response. No one listens.
Drbitboy is right. The P1 needs to be controlled by both T1 and T2 levels for better control. P1 could be controlled to keep the levels in both tanks equal percentage wise. This would basically make T1 and T2 like one big tank.
 
The P1 needs to be controlled by both T1 and T2 levels for better control. P1 could be controlled to keep the levels in both tanks equal percentage wise. This would basically make T1 and T2 like one big tank.

^ This. @Peter Nachtwey solved this in the first reply of this thread.

(i) Ki should be zero on both PIDs. As @Saffa notes, the non-zero integral term is causing the fluctuation.

(ii) The output biases for the PIDs, which, because Ki is 0, will be the PID outputs when the respective levels are zero, should be equivalent to a flow of something close to, but less than, 100gpm e.g. 98gpm, 95gpm, 90gpm. I.e. whatever, combined with the gains (see item (iii), next), keeps the pumps from cavitating when the inflow is 100gpm.

(iii) The gain of each PID should be, in combination with the bias from (ii) above, set to ensure the flow is something close to, but more than, 115gpm e.g. 117gpm, 120gpm. I.e. whatever keeps the tanks from overflowing when the inflow is 115gpm.

If the downstream UV system trips with this configuration, then the tanks are not big enough and this is a design problem that cannot be solved with the current tanks and control approach.
 
the control philosophy is using tank level for flow control.

This is the start of the problem. The control philosophy should be to eliminate UV system trips, and to do that we need to utilize the capacitance of the tanks to smooth out variations in inflow (wells + decant) when setting the Pump 2 PID output signal.

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.

Am I the only one who sees the inconsistency of those statements?

Specifically, we do not need tight tank level control.
 
Last edited:
mean inflow is 103.75gpm: (9h @ 100gpm + 3h @ 115gpm) ÷ 12h

So for 9h = 540min, the inflow is 3.75gpm below the mean, so that is 2025gal of short flow during those 9h.

And for 3h = 180min the inflow is 11.25gpm above the mean, so that is 2025gal of excess flow during those 3h.

So the tanks, with a combined capacitance near 3500gal, should be big enough. In theory, the Pump 2 PID output could be set to a fixed equivalent of 103.75gpm and the system would run fine. Of course, that is only in theory; in practice, the inflows will vary slightly so eventually Tank 2 would overflow or cause Pump 2 to cavitate. If the Pump 2 speed were adjusted every 12h, e.g. at the end of a decant cycle, based on the maximum levels of the tanks, then it might be possible to have a very stable flow to the UV system.

Does the level of Tank 2 affect the input head at Pump 2 enough to cause significant changes in pump flow?
 
Last edited:
@mobil1syn: what are the PV and CV engineering units into the PID loops?

I.e. what are the level values that correspond to PV=0% and PV=100% in the PIDs, and what are the Hz values that correspond to CV=0% and CV=100% in the PIDs?
 
Here is a simple model of the approach I suggested, that would require only adjusting the tuning parameters of the PIDs:
levels_098_116.png flows_098_116.png
So the maximum rate of change of Pump 2 flow to the UV system is a few (3? 5?) gpm per hour.

That may still be too steep. By lowering the gain of the Pump 2 PID, so it would run at 103gpm when Tank 2 is empty (level = 0) and at 105gpm when full (level = 6), more of the second tank's volume (capacitance) would be used to lessen the rate of change in flow-rate to the UV system, to less than 1gpm/h.
levels_103_105.png flows_103_105.png
I am not sure if that last one had reached a stable point after 3 decant cycles, so those numbers may need to be tweaked.

Obviously this approach is very simple-minded and does not consider any operational risks e.g. if a decant cycle went long, or if one or more wells were shut off for maintenance. I suspect most of those issues could be handled by an operator adjusting the biases to one or both PIDs, but I would not guarantee it. I assume in the current system, where the existing automatic control is causing trips, that process upset result in the PIDs being switched to manual mode and operators controlling the pumps directly.

BTW, I assume the tanks are cylindrical, but are they oriented with the axis of symmetry vertical or horizontal?
 
Last edited:
Amazing! drbitboy is still pulling teeth. Nice graphics.
I should learn hot to use .git.

However, I don't see the operation like drbitboy does. The inflow can change in steps of 25 gpm. I dont know if the 15 gpm is constant or not since the OP doesn't say.
What drbitboy should be simulating is changes in the outflow of P2 for the process down stream. It is the demand downstream that the upstream pumps must respond to.
drbitboy is changing the upstream pumps in BIG steps, not steps of 25 gpm.

At this point I would have fired all involved.
This problem is simple. It is only the lack of information that is dragging this out.
 
Amazing! drbitboy is still pulling teeth. Nice graphics.
Yeah, it's nice what can be done with a few dozen LOCs.
I should learn how to use .git.
Heh, yeah, it's a game changer. I use command line a lot, but there are very nice GUIs. Also, Github is a decent way to collaborate that works well with git; there are other web-based tools as well (Gitlab, etc.) that have revolutionized how code is produced.
However, I don't see the operation like drbitboy does. ...
It is more useful actually looking at the teeth that are available than seeing the operation the way you imagine it.

Re-read the first post; a summary follows ...

"Normal" operation

  1. 4 wells each running 25gpm, so 100gpm total baseload.
  2. Decant adding 15gpm to that base load for 3h out of every 12h.
So 9h of 100gpm, then 3h of 115gpm, rinse, repeat. There is no mention of 25gpm steps, although one would expect that for maintenance or other well outages.

While OP is able to change at least the tuning constants of the PIDs, re-configuring the control system is a non-starter politically.

  • I take this to mean that re-programming the PLC to do something other than two independent level PIDs controlling the pump speeds is not on the table.
A later tooth informed us that

  • Process 1 can handle significant feed flow-rate changes, but the Sand Filter and Process 2 (UV system) will actually trip if its feed flow-rate, i.e. what Pump 2 takes out of Tank 2, changes too much
    • I take this to mean the most important thing is to avoid tripping Process 2,
      • which in turn means the rate of change of flow from Tank 2 by Pump 2 should be minimized.
  • The measured level in the tank relatively unimportant
    • I take this to mean the pump should not be allowed to cavitate, and the tank should not overflow,
      • but other than that, as much of the capacitance of the two tanks should be used as possible to minimize the rate of change of Pump 2 discharge flow-rate.
The correct solution would be to change the control scheme, of course, but that is not possible at present. So my model operates within the constraints as presented, basically implementing the scheme @PN elucidated.

It should be possible to keep the Pump 2 discharge flow-rate essentially constant through every 12h cycle, which I think might have been the original intent. It might work better if the larger tank were first. But politically at least, none of that is possible with the current PID-based control scheme.
 
Last edited:
"Normal" operation

  1. 4 wells each running 25gpm, so 100gpm total baseload.
  2. Decant adding 15gpm to that base load for 3h out of every 12h.
So 9h of 100gpm, then 3h of 115gpm, rinse, repeat. There is no mention of 25gpm steps, although one would expect that for maintenance or other well outages.
yes, but do all 4 gpm sources need to run all the time? This isn't specified.
How much does the UV process require? It hasn't been provided.
Eventually the inflow and outflow must be relatively equal to keep the tanks from over flowing or going dry.

While OP is able to change at least the tuning constants of the PIDs, re-configuring the control system is a non-starter politically.
The OP hasn't made it clear if the control system is controlling the pumps 1 and 2. We have assumed it does.

The OP said he tried using P only and it didn't work. What didn't work? Why didn't it work. What gains did he use? Did he implement a proportional band like I suggested?

We agree that for best control the two tank levels can't be controlled independently. Nothing has been said about using the level of tank 1 to be a bias for P2 and vice-versa. If tank 2 is running low then P1 should keep running even if it is running low but the two tanks should NEVER be low of the source inflow is about what the UV process requires.

  • I take this to mean that re-programming the PLC to do something other than two independent level PIDs controlling the pump speeds is not on the table.
A later tooth informed us that
Yes, you extracted another tooth. However, it should have taken that long.

So why did the OP bother us with this question if he didn't want our answer?
I don't see how a simple proportional only with a bias is too much of a change.

  • Process 1 can handle significant feed flow-rate changes, but the Sand Filter and Process 2 (UV system) will actually trip if its feed flow-rate, i.e. what Pump 2 takes out of Tank 2, changes too much
    • I take this to mean the most important thing is to avoid tripping Process 2,
      • which in turn means the rate of change of flow from Tank 2 by Pump 2 should be minimized.
      Why does tank 2 level change too much? It shouldn't unless the UV process changes a lot and there is no feed back to P1 and P2. The OP didn't mention anyway to know what the UV demand is. If we know the flow required from the UV process we can adjust the bias for P1 and P2.
    [*]The measured level in the tank relatively unimportant
    • I take this to mean the pump should not be allowed to cavitate, and the tank should not overflow,
      • but other than that, as much of the capacitance of the two tanks should be used as possible to minimize the rate of change of Pump 2 discharge flow-rate.
The correct solution would be to change the control scheme, of course, but that is not possible at present. So my model operates within the constraints as presented, basically implementing the scheme @PN elucidated.
So why bother us? Who is the idiot that made the restrictions? Make him fix the controls.

It should be possible to keep the Pump 2 discharge flow-rate essentially constant through every 12h cycle, which I think might have been the original intent. It might work better if the larger tank were first.
No, bigger second tank allows for more variation in inflow. It the UV process had some sort of demand indicator it could be used as a bias for P2 and the proportional gain for P2 could be very low and allow the level in T2 to change a lot. A high P gain for P2 would cause the flow to the UV process to vary more. Adding an integrator would make it even worse as it winds up and down.

But politically at least, none of that is possible with the current PID-based control scheme.
Agreed assuming the UV requirements don't change much.
So why bother us? Screw politics. Do you know how many times I have had to tell the customer they are doing it wrong? Nobody likes being told they are wrong.

What gets me is the inflow is 100 gpm most of the time. Since the outflow must be equal to the infllow, does the UV process require 100 gpm? We are not provided that information. Why not remove T1 and T2 and connect the 4 25 gpm sources to the sand filter? What the heck is varying so much? Why are there 2 tanks instead of one?

If the OP is trolling us, he is doing a pretty good job.
 
If the OP is trolling us, he is doing a pretty good job.


:ROFLMAO::ROFLMAO::ROFLMAO::ROFLMAO::ROFLMAO:

It's hard to tell the difference. The most interesting statement from OP was this:
i tried just using the proportional but it wouldnt react or it would react erratically causing the UV to trip.
The only way I would expect those results would be if Kp was too small or too big, or perhaps by the time the gains are large enough, the noise in the level signal puts noise into the UV feed flow and causes a trip.

The posted trends almost certainly point to an Integral-only controller i.e. Kp too small (Independent gains), as the integration of the no-P/I/no-D does not play nicely with the integration of a tank level: PV and CV trends are a very nice and predictable cosine-sine pair i.e. 90° out of phase.

Btw, I ran the model with a constant 103.75gpm Pump 2 flow-rate; see below. It looks great, predictably, but of course that is in a noise-free numerical model with no drift in the base or decant flows.
levels_103_103.png flows_103_103.png
 
I’ll try to solve OP problem using instruments OP (probably) have

The trend from #15 shows that the level signal has noise of approximately 0.05 ft.
So if we apply ki to (for example) 10, we get powerflex input frequency noise of 0.5 Hz. I think this is what the OP is writing about.

Suppose simple signal-filter is available for OP. I’ve filtered level signal by TF: 1/(200*s+1) or y (i) = y (i-1) + (U(i) - y (i-1)) dt/(200+dt)

Tank 1 loop PI settings: Kp = 12.5 Ki = 0.0078

Tank 2 loop PI settings: Kp = 21 Ki = 0.0133

I’ve modeled tanks loops. Applies Tank 1 outflow as Tank 2 inflow. I understand that process 1 should be taken into account, but we do not have any data about it.
I will make a reservation right away: the models are very approximate, as well as the parameters of the PI controller

mobil1syn to define process 1 transfer function Tank 1 outflow and Tank 2 inflow (or level) curves needed

Tank1.png Tank2.png
 
I’ll try to solve OP problem using instruments OP (probably) have

The trend from #15 shows that the level signal has noise of approximately 0.05 ft.
So if we apply ki to (for example) 10, we get powerflex input frequency noise of 0.5 Hz. I think this is what the OP is writing about.
how do you figure? By now you should know a Ki of 10 means nothing without units.


Suppose simple signal-filter is available for OP. I’ve filtered level signal by TF: 1/(200*s+1) or y (i) = y (i-1) + (U(i) - y (i-1)) dt/(200+dt)

Tank 1 loop PI settings: Kp = 12.5 Ki = 0.0078

Tank 2 loop PI settings: Kp = 21 Ki = 0.0133

I’ve modeled tanks loops. Applies Tank 1 outflow as Tank 2 inflow. I understand that process 1 should be taken into account, but we do not have any data about it.
I don't think filtering is the main problem although what you suggest wouldn't hurt. The main problem is what you said in the last sentence about not having any data.

I will make a reservation right away: the models are very approximate, as well as the parameters of the PI controller
An integrator isn't required unless a precise level must be maintained. If set right, an integrator will not hurt but if not then integrator wind up and wind down will be a problem. Adjusting biases bases on levels and flows is the way to go.

mobil1syn to define process 1 transfer function Tank 1 outflow and Tank 2 inflow (or level) curves needed
Not much needs to be modeled. T1 and T2 are pure integrating process. There are no time constants unless your low pass filters are added and if the units are milliseconds seconds then they are so fast relative to the process that they can be ignored.

Again, I ask. If the flow to the UV process must be constant then why have the two tanks? Bypass the tanks.
 
If the OP is trolling us, he is doing a pretty good job.

definitely not trolling. the input is appreciated and gives me things to ponder in finding a resolution. some of the comments are above my head, so it takes me time to research and understand so i can respond with some intellect.

drbitboy and Maxk is on track with their assumptions, i am unable to change anything and have to work with what i have been given. at this point, changes to logic, piping, etc are off the table. if i cant get things sorted out, then i will start down the road.

p1 and p2 are controlled independent of each other. when i tried to utilize the P only for level control i could not get it to oscillate, it would just keep pumping down (see the trend below, P was 30 for both tanks). if i can find a P setting that gets me a consistent flow with a tank level variation +/- 1' we have a winner. the UV manufacture tech support people cant give me any parameters to work within, trending have shed some light on other things and tech support is working to escalate things to someone who knows how their controls work.

the UV is slow to respond to the flow, so if p2 flow goes from 90-115gpm in 60secs (perceived numbers based on what i observed, since i cant get a number from the UV mfg) then the UV cant respond and trips. the UV design range is 100-1500gpm for this unit, which is a completely different topic.

is it possible i am trying fix the wrong problem? maybe
do i think there are some issues with the design? yes
after operating things do i think there is room for improvement? yes
could i get the integrator who built this system out here to give me a functional plant? maybe, i need to make sure i can back up my statements
anyone can say something doesnt work, but i want to be able to effectively articulate the WHY it doesnt work with a potential solutions.

Screenshot 2022-12-30 153745.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,264
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,586
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
63,115
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,152
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
985
Back
Top Bottom