Level Controller Tuning
Level control loops are common in industrial processes, but tuning level controllers can be challenging. Many level loops oscillate, sometimes causing large parts of their adjacent processes to oscillate with them. This article describes how to tune level controllers.
An important thing we need to know about level loops is that liquid level in a vessel is an integrating process, which responds differently from a self-regulating process. Therefore it has a different process model that requires a different set of tuning rules. See my article on level control loops for some general guidance.
Level controller tuning really is not all that difficult if you follow a few basic steps. There are always a few outliers, but in general I like tuning level loops and find them reasonably easy to tune. If the level controller output cascades to a flow controller (more info here), you have to tune the flow control loop first. I’ll assume you have done that already and are now ready to tune the level loop.
You should tune any controller based on the process’ dynamic response. Obtaining a model for the dynamic response of a tank’s level is easy:
- Make sure as far as possible that the uncontrolled flow into/out of the vessel is as constant as possible.
- Place the level controller in manual control mode.
- Wait for a steady slope in the level. If the level is volatile, wait long enough to be able to confidently draw a straight line though the general slope of the level.
- Make a step change in the controller output. Try to make the step change 5% to 10% in size, if the process can tolerate it.
- Wait for the level to change its slope and settle into a new direction. If the level is volatile, wait long enough to be able to confidently draw a straight line though the general slope of the level.
- Restore the level to an acceptable operating point and place the controller back in auto.
Now determine the process model:
- Draw a line (Slope 1) through the initial slope, and extend it to the right (Figure 2).
- Draw a line (Slope 2) through the final slope, and extend it to the left to intersect Slope 1.
- Measure the time between the beginning of the change in controller output and the intersection between Slope 1 and Slope 2. This is the process dead time (td), the first parameter you require for tuning the controller.
Note: Express your dead time measurement in the same time-base your controller uses for its integral time setting, i.e. minutes or seconds. - Pick any two points (PV1 and PV2) on Slope 1, located conveniently far from each other to make accurate measurements.
- Pick any two points (PV3 and PV4) on Slope 2, located conveniently far from each other to make accurate measurements.
- Calculate the difference in the two slopes as follows:
DS = (PV4 – PV3)/T2 – (PV2 – PV1)/T1
Note: Express your T1 and T2 measurements in the same time-base your controller uses for its integral time setting, i.e. minutes or seconds. - If your PV is not ranged 0 – 100 %, convert DS to a percentage of the range as follows:
DS% = 100 x DS / (PV range max – PV range min)
Calculate the process integration rate (ri) which is the second and final parameter you need for tuning the controller:
ri = DS% / dCO
Now that you have the dead time (td) and the process integration rate (ri), you can tune the controller. If the control objective is a nice and fast response to quickly recover from disturbances, you can use a modification of the Ziegler-Nichols (Z/N) tuning rules. The modification involves a slight detuning of the controller because the original Z/N tuning rules result in a very aggressive loop response and low tolerance for any change in operating conditions. I call the amount of detuning the stability margin, denoted by SM. You should set SM to a value of 2.0 or larger. The larger you make SM, the slower the loop will respond. In this way you can use SM as a fine-tuning factor.
Note:
- The tuning rules below assume your controller’s proportional setting is in gain Kc, not Proportional Band, PB. If not: PB = 100 / Kc.
- The tuning rules below also assume your controller’s integral setting is in units of time Ti (i.e minutes or seconds), not repeats per time Ki. If not: Ki = 1 / Ti.
- The tuning rules below also assume you have a controller with an interacting algorithm (although they work fairly well on noninteracting algorithms too), but not a parallel algorithm. For controllers with the parallel algorithm, you need to divide Ti by Kc, and multiply Td by Kc, to obtain their integral and derivative settings, respectively.
- See my article on PID controller algorithms for more details.
To calculate tuning constants for a PI controller:
Kc = 0.9 / (SM x ri x td)
Ti = 3.33 x SM x td
Td = 0
And for a PID controller:
Kc = 1.2 / (SM x ri x td)
Ti = 2 x SM x td
Td = td / 2
Important Note:
Some level controllers should not respond fast, e.g. when controlling the level of a surge tank. Surge tanks need a different set of tuning rules to ensure you make maximum use of the surge capacity, while not exceeding the upper and lower level limits. Follow this link for tuning surge tank level controllers.
Stay tuned!
Jacques Smuts – Author of the book Process Control for Practitioners
Used this method this week to tune a level loop that has not run in automatic since installation (4+ years). Operators have been controlling level manually. Problem was that the level filled at a faster rate than it emptied. By taking into account both the filling and emptying rates in this formula, the loop was successfully tuned and has been running in automatic all week. The operators are extremely happy.
Thanks for the great blog and I look forward to reading your book.
Andrew
Maybe I’m missing something here.
You state “Make sure as far as possible that the uncontrolled flow into/out of the vessel is as constant as possible. Place the level controller in manual control mode. Wait for a steady slope in the level.”
If flow in equals flow out, won’t level remain constant? How will you ever see a steady state slope in level?
Love your blog BTW.
Ted, although it would make the calculations easier, this tuning method does not require that inflow = outflow. In practice, it is very difficult to get the level to remain absolutely constant. The level normally slopes up or down over time when the controller is in manual. As long as the inflow remains constant, and the outflow remains constant, the slope will be constant. That is why the procedure asks for a “steady slope” and not a constant level.
How can we make level control valve (or all level control loop ) responding faster to level change. especialy when the level rises and we dont want to over flow.
there is any improvement to add to level control loop to have that.
thanks
Belami – it is mostly the controller gain that determines how fast the valve responds to an increase in level. Increasing the controller gain will make the valve respond faster. However, using too much gain will cause the loop to become unstable. Using derivative control mode can speed up the response a little bit too. Use the tuning methods on this page. If the response is too slow, consider using feedforward control.
Hello Jacques. The above tuning method for level controllers works for both interactive and non-interactive PID algorithms without any conversion for the PID constants from interactive to non-interactive algorithms?
Thanks!
Emil – If you use PI control (no derivative) then no conversion is necessary. As I said in the second last bullet above, the PID tuning rules assume you have a controller with an interacting algorithm. But they work fairly well on non-interacting algorithms too. Ideally you should convert the PID settings from interacting to non-interacting for the best performance when using derivative.
Also, the process integration rate (ri) has a negative value, when calculated with the formulas from this page. Can be the negative sign simply neglected?
Emil – Good question. Yes you would ignore the negative sign on ri. However, if ri is negative you should configure your controller to be direct-acting (Error = PV – SP). If ri is positive you should be using an indirect-acting controller (Error = SP – PV).
Jacques – thank you very much for clarifications. Your blog is the best I found so far; everything is very clear and concise; exactly what an engineer needs. Congratulations. I really appreciate your effort.
Great write up. I’d like to try this method but have a simple question. If the level controller sends remote setpoint to a flow controller, how would it effect this method? The level controller output is in GPM (not % out) and is ranged 0-2300 GPM (not 0-100%). Wouldn’t this effect the tuning?
Eric: It depends on the DCS/PLC type. Most, but not all control systems convert the 0-100% to engineering units with no adjustment required to tuning. One Exception that I know of that does not internally rescale is the Emerson Ovation system. For users of that system, I suggest using 0-100% as the controller output range, and externally scale it to engineering units using a multiplication block.
Hello Jacques, and thank you for this very practical tuning rules. In my mind, a P- or a PD-controller would also work nicely to control level. But I don’t see anyone using these types of controllers… What is your opinion?
Morvan: PD control (no integral action) should work fine for level control if the control loop is subjected only to setpoint changes, but if the non-controlled flow rate (into or out of the vessel, depending on the design) changes, the level will deviate from setpoint and remain offset. Integral action is used for bringing the level back to setpoint after a process disturbance.
Hi
If the slope is the opposite to the example (i.e. when placing the controller in manual the level drops and then rises after step change in output)
How would this impact the calculation of DS?
Thanks
Peter: Good question. One should use the absolute value of ri (or DS) in the tuning calculations to obtain a positive controller gain setting. PID controllers normally have a setting to change the control direction from direct acting (needed for the example) to reverse acting (typically when controlling flow into the vessel).
Hi
I have read your book and used it as my main reference to design my control loops. One thing I still find hard to understand is: why do you have to convert your PV change to a percent of PV-span?
Let’s say I have a level controller with a setpoint of 2 meters, how does the full range of my level measurement make any difference on the controller gain. When my total tank height is 3 meters or 5 meters, the error should have the same effect on the valve position, right?
note: my PLC’s PID block does not scale the PV (or error) to a percentage. I read that some systems do have this normalization, but I have never seen it.
Julian: Most industrial PID controllers convert PV from engineering units to a normalized PV in percent. So, for tuning rules (equations) to work, you have to normalize your bump test results to obtain the PID algorithm’s view of the PV response. If your controller does not do normalization, then no conversion is needed for tuning. I’m curious what type of PLC this is. Almost all the systems I have ever worked on do normalization.
Jacques,
The Triconex safety PLC can do PID type control, but the PID block does not internally scale the inputs. I use a calculation block to scale the input before I feed them into the PID block.
Jacques: I mostly use Siemens 1500 PLCs, but also Beckhoff, Schneider and Rockwell. I actually use my own PID block instead of the builtin one, so I can use the same algorithm across all of them. Any other PID examples I could find for example in C or Python also did not scale the PV.
Is there an advantage in using normalization?
Anyway, thank you for the confirmation. I will take this into account for my future calculations.
Just checked the Rockwell documentation and it states: “E = Error in percent of span”. Could be an American vs European convention.
Julian, the advantage of scaling is that the tuning numbers appear more “normal”. I worked on an unscaled PID for a power plant system a few months ago and the generated power signal to the PID controller was in watts. The calculated controller gain was 0.00000085, which was correct mathematically, but seasoned tuners of scaled PID controllers will agree that the number just looks wrong. If the PID inputs were scaled, the gain would have been 0.85 – a much more palatable number.