PID Water Flow and Level Control


Thread Starter


I need to maintain a constant flow AND a constant level in tank.

Water flows into the top of a tank which in turn is drained by a modulating control valve. I have a level sensor and a flow meter which is located at the bottom of the tank after the valve.

I have two PID loops. One for flow, one for level. I can control the process by either.

The problem - When using level control, my flow rate varies greatly. When using flow control, I cant keep a good constant level.

There are many articles on the web about cascading PIDs but I'm not sure that this fits my application. What I need is a constant flow at a constant level using a single control valve.

Any suggestions?


Bruce Durdle

You are trying to go in the face of one of the fundamental rules of control systems - "You can control only a single variable with a single knob (or valve)."

If the flow into the tank is unconstrained, the level will be the integrated accumulation of the difference between inflow and outflow - if outflow does not equal inflow, the level will increase or decrease. The only way to maintain a steady level is to exactly match the inflow and outflow at, all times. If you want to maintain a steady flow out with varying flow in, you have to accept the resulting fluctuations in level (and hope that, over time, the outflow is equal to the average inflow).

In mathematical terms, you have a system with three variables - the inflow, the outflow, and the level. The inflow is a wild variable and you have to accept the way it varies with time. Once the inflow is set, the level and outflow are not independent as they are directly related by the physics of the situation. So you have only a single independent variable which can be manipulated by a single valve.

The simple answer is... You Can't

You HAVE to compromise. Decide which is more important to you and tune accordingly. You will probably find it easier to tune the level control.

If you tune the level control slowly you will minimize the flow disturbance but have greater variation in level.

If you want a very tight level control then the flow will have to vary to maintain the desired level.

If you want to reduce variation in the outlet flow without changes in tank level you need to reduce the "load" changes - i.e. the external disturbances - on the system. Typically this is the inlet flow.

If you haven't already found it, try here -> and look at Averaging Level Control

if your modulating drain valve is controlled by demand, then you have a wild flow demand on the tank level.

The best you can do is to maintain average level. This is usually done by integral only control of the level but you also need some high/low control points to override in the event that a large demand tries to drain the tank, or the demand drops to zero.

In effect you are using the surge capacity of the tank rather than trying for setpoint control, good luck
Hi Brian,

We are using same criteria by using Pressure Transmitter and Control Valve to maintained the flow and level of the tank (Water) as a closed loop system via Single PID-Loop (PI-Controller).

Abdul Ahad