Rejecting sensor noise in tank level control

  • Thread starter Antony Hilliard
  • Start date

Thread Starter

Antony Hilliard

I'm having some serious trouble with flow/level control in a large tank. The tank is fed constantly, the tricky bit is that it's aboard ship and as the boat rolls, the level indicator changes value, and the PI-controlled pump ramps up and down to compensate. These variations in flow speed are hurting our process.

These variations in the apparent tank level have a period of about five minutes and an amplitude of between +- 2 to 5 cm depending on what kind of seas the ship is in.

Flow in is governed by a magmeter, at a constant rate of around 5m3/hr. The tank has a cross sectional area of 7m2 and the pump can run at between 2 and 7 m3/hr. So an apparent ten centimeter level change from ship's roll represents a volume equal to about ten minutes of system flow or an hour and a half of the inlet and discharge pumps running within 10% of each other (an acceptable value).

Right now we have a guess-and-tested P-I loop implemented to control the discharge pump. It maintains level well but at the cost of ramping the pump up to full speed then down to stopped, and repeating. Decreasing the integral component only makes it worse. Really, we don't care about the level in the tank varying +- 10 cm, so long as the flow is more or less constant.

Big tank, small pump, lots of signal noise. What should I do?
How are you measuring the level?
Have you tried to average the level reading prior to going to your PID control?
Have you tried to set a lower discharge flow rate setpoint and then set upper and lower limits so your pump will not ramp up to full speed and down to stooped or 0 speed? It may be possible to maintain a more consistent flow rate (output) by slowing down the PID control (make it less sensitive), this way you can ride through the changing tank levels as the ship rolls and pitches about.

If your using an ultra-sonic level transmitter, most good ones have agitator elimination and averaging compensation options to reduce noise or false level signals or to reduce erratic level reading due to a sloshing effect inside a tank.
Pressure transmitters may only be able to give you a 10 second avergage at best, some prehaps longer, but I don;t think out to the 5 minute range.


calvin smith

Where in the tank is the sensor located?
The closer to the center of the tank the better.
Have you tried to baffle the tank to reduce the
amount of change in the level. You could use a buffer to average the sensor signal. The only problem with a buffer is if it is to large there might be to muuch lag on the pump. hope this helps.

Antony Hilliard

The tank depth is measured with a bubbler-type hydrostatic pressure sensor on the side of the tank. It is all existing ship's equipment and there is no practical way to modify the level sensor nor to add any baffling to the inside of the tank.

Matt, by 'slowing down the PID control' do you mean using smaller coefficients or actually decreasing the frequency of the controller updates?

Averaging the signal is a good idea, but with these oscillations happening over five minute periods I wonder if what Calvin said about time-lagging the system will be a problem.

Upper and lower limits would also be okay but if we could get the PI loop to work properly I'd be happier.

I've tried to put together a theoretical analysis with transfer functions and process flow schematics but have become quite rusty since getting out of school! How frustrating.

Thanks for the quick feedback! Please keep it coming.

I would try reducing the coefficients, if that does not work slow down the frequency of controller updates. I will continue some thought on this and do some reading, perhaps I will come up with something to assist you further.

There are some good post on here re: PI control and for sure do some searching. Does the bubbler have needle valves? if so, try turning them in a little at a time, this should reduce the amount of air/liquid in the unit and perhaps act as a why to average the signal, also, perhaps adding a way to pulse the air through the bubbler every 4 to 6 mins would help, I am trying to think of ways to average the signal, which would preclude change out of equipment.

If you want to get rid of a sine wave that has a 5 minutes cycle, you will need a 1st order filter of 8 minutes (90% attenuation). You CANNOT filter faster than your closed loop time constant. Also the selection of your closed loop time constant is dependent on you process constraints: if the time to overflow is 10 minutes, your closed loop time constant will be 10 minutes and the maximum filter time will be 3 minutes for your loop to be stable.

The first question to ask yourself is your retention time and your overflow time. The smallest time will set your time constant (the idea on a level is typically to keep it floating so that the inner flow controller is not going nuts). From the time constant, you can calculate PI settings. If the closed loop time constant is too small you HAVE TO FORGET about filtering. One of the solution might be to analyse the sine wave on-line and then predict the level disturbance that you do not want the controller to act upon. Simply take this predicted sine wave, substract the PV and control this new level measurement.

Hope this helps,

Ben Janvier, Process Control Consultant,
EnTech Controls

Andrey Romanenko

Hmm... even if the meter has no averaging function,
it can be implemented externally as, say, moving average
filter. If the time constant of the rolling process is much smaller than the time constant of the system itself, this approach should do the trick. Otherwise, the performance of the flow control will be undermined.


John G. Boland

Hi Antony,

It is easier for me to visualize a mechanical analog of your problem:

A car follows another along a road. The lead car's speed is accurately controlled. A "bungie" cord connects the rear bumper of the lead car to the front bumper of the second. The tension in the bungie is used as the process variable to adjust the second car's throttle (no speed control). No one cares how far apart the cars are, except the bumpers must not collide or the bungie stretch to breaking.

This springy system is stable on smooth terrain, but rapid uphill and downhill changes are problematic. Averaging the tension readings will cause the distance between the cars to vary more, while increasing the responsiveness of the second car's throttle to the tension will cause it to "gun" and "idle".

At least one control loop, of some kind, is missing. In this example, it might be a tight speed control on the second car, with a supervisory setpoint (long time constant) from the tension. An even tighter system would be to feed the lead car's speed as a supervisory input, modified by a very heavily averaged tension, to the second car's speed control.

Anyway, in the case of your tank, as the ship rolls and the physical depth of the liquid changes, the outlet pump's inlet charge pressure changes and, subsequently, the outlet flow may also change at constant pump speed. Making this worse, from a modeling point of view, is that the tank cross-section may change as the liquid sloshes (I am guessing that the tank is cylindrical, but you do not say - or whether the slosh is lengthwise, crosstank or both).

Would you consider a second magmeter on the outlet flow, with a PI loop controlling the outlet pump speed, with a supervisory setpoint from the inlet pump flow, modified by a very long-time-constant level control PI loop? Rough guess, five or ten times the cycle time - 30 to 90 minutes? The best might be the time required for a given number of complete sloshes, updated as conditions change. The outlet pump speed control time constant should be less than one-tenth as long, or around 3 minutes or less.

A mechanical approach would be to install a second level detector in the tank, cross-axis from the existing sensor and average the two readings. By and large, one will increase as the other decreases, but you would have to very careful (and lucky) to get the location correct.


John G. Boland, president
[email protected]
Strateg!c Method$ Corporation
One Parker Square Suite 408
2525 Kell Boulevard
Wichita Falls, Texas 76308
940.723.1478 fax
Have you thought of trying a level sensor? Not for level in the tank but that the ship is level ie upright. I am not familiar with this type of control but only detecting and operating within a range of + or - 2, 3, or 5 degrees of level and storing the value until you are at that point again seems to me to be a reasonably sensible approach.
John Boland,
An excellent analogy.

Anthony Hillard,
Have you looked into a second level measurement diametrically opposite the original location. Even a third, etc, if "roll" dirction is unpredictable! Thenm average their outputs. In theory the pump is compensating for the volumeric loss over time! Hence, is there an
integral component?

Phil Corso, PE
Boca Raton, FL
[[email protected]] ([email protected]) {[email protected]}

Andrey Romanenko


<p>The simpliest mechanical approach would be to turn
the tank 90 degrees if the pitching of the ship is

<p>Another mechanical approach if a second level sensor
is available:

<p>Don't modify the tank, but install a U shape hose outside the tank across the ship's hull as close to the tanks's walls as possible and install the second level onto the pipe on the same side of the
tank where the first sensor is located:
|| x x ||
hose || x x -- ||---
|| x tank x | || |
|| x x | || |
|| x x LI1|| LI2
|| x x | || |
\\ xxxxxxxxxx -- //---
<p>Now fill the hose with the same liquid as the one
in the tank to the desired level. When the ship banks, both sensor readings will be affected in the same, or very similar way.Devise a PI(D) controller whose
controlled variable is the difference between readings of
LI1 and LI2, the setpoint of this controller is 0
(you want the tank level to be maintained), and the manipulated variable is the inlet flowrate.
The resulting control loop will maintain the liquid in tank at the same level as in the hose.
Of course, I have made some assumptions here, so
don't expect this solution to be perfect. Just good enough.

Adding additional equipment at this point is unfortunately not going to happen. Also, it's another maintenance requirement, etc.

That would be a really good piece of data to have, I agree.

Antony Hilliard


I'm not sure what you mean by retention time and overflow time.

Our system is basically a tank that is 85% full at normal operating conditions, with an even flow in. The tank is 23m3 at the operating depth, and the flow is about 4-5 m3/hr in, so the retention time is 5 hours, and if the outlet pump was shut off the tank would overflow in 1 hour.

Antony Hilliard


The operator has reduced the coefficients further, and the pump speed variation has improved somewhat. Even tied up at dock, with what I would assume are minimal level oscillations the pump speed is gradually ramping up and down between 400 and 650 RPMs - I wonder if the system is mathematically unstable?

Can't adjust the bubbler as it is part of the ship's systems and by the regulations of their insurance company must have level indication from certified instuments to their control room at all times.

Antony Hilliard


Thank you for the extensive reply. There is some good news about the process I'm trying to control:

- The pump out is a progressive-cavity type. It's roughly a linear relation between RPM and flow irrespective of pressure on either side.

- The tank is a cylinder standing on axis, 3m diameter and 3.88m high. The cross-sectional area of the tank stays the same all the way up.

Installing new equipment whether it be a magmeter or a second level sensor is unfortunately out of the picture for now. PLC programming changes will have to do.

John G. Boland

Hi Phil Corso,

I agree with your sensor placement issues - did not make them as clear as you did. Ideally, one sensor would be placed at the longitudinal and cross-axis center of gravity of the tank, since slosh will "average out" there (mostly). If the sensor is at one end (and/or side) of the tank, its variation is 'way more than if it were located at this center of gravity.

Unfortunately, Antony says he can not add more sensors or move his existing sensor.

And, Phil, I agree that the level is a time-integrated function of the differential between the inlet and outlet flow rates. That's why I thought that "servoing" the output pump m^3/hr to the inlet pump m^3/hr would provide enough time constant differential for heavy filtering of the noisy level signal, which could then be used to "trim" the differential setpoint.

And thoughts for us data modelers out there... IMHO, of course...

There will be a time-variant "fundamental ocean wave frequency", varying also, perhaps, with crossing-wave secondaries... (In North-Central Texas we don't worry about such things much, but I saw some movie about "The Perfect Wave"...) Depending on the actual tank dimensions, there will also be a longitudinal-tank fundamental frequency and harmonics thereof. Lastly, there will be a cross-tank fundamental frequency and harmonics thereof (probably the highest and easiest to remove with filters).

These three fundamental frequencies will, in the general case, not be even multiples of each other nor will they be synchronous either with each other or with the inclination of the ship... well, perhaps accidentally synchronous, but lagging... Paren(1) I like BobB's idea of sampling the level signal versus inclination - perhaps as a function of the derivative of the inclination... Paren(2) JimU's Wyler inclinometer spec sheets look really good - does anyone have practical experience with them?

It would be possible to construct a software phase-lock loop for the level signal and use the zero-crossing to compute integral-cycle average level calculations, if additional accuracy is required.

In any case, initializing and ramping the setpoint of such a long time constant level control loop will be more_than_a_little tricky.

It would be interesting to have several thousand level data points vs. time to look at.

Think I would add the outlet magmeter flow-control loop and *really* consider relocating the level detector to the tank center of gravity, even if it required a little work or waiting 'til port. (Easy for a landlubber to say, huh, Antony?)


John G. Boland, president [email protected] Strateg!c Method$ Corporation One Parker Square Suite 408 2525 Kell Boulevard Wichita Falls, Texas 76308 940.322.9922 940.723.1478 fax
Well, sounds like some improvement was made, that is good, where do you presently stand as far as system stability? Just to be sure everyone is one the same page, completely discribe the control loop and what you are attempting to acheive. It may help all of us who are responding help you in solving your issue.

Look forward to hearing back from you.



John G. Boland

Hi Antony,

The dimensions are good news, indeed.

You may be able to get a performance improvement without any new equipment (well, sensors etc.) by feeding the existing inlet magmeter flow signal, as an "RPM" setpoint, to the outlet progressive-cavity pump electronic drive.

Modify the flow signal with the existing level measurement, that is, the result of the level control loop is a multiplier between (for example) 0.5 and 2.0 times the magmeter flow signal, before the outlet pump electronic drive. The level control loop will primarily function as a slow "automatic correction" to minor differences between the theoretical and actual pump differential flows. The value of the multiplier, after the level control loop runs a while, mathematically becomes the conversion factor between m^3/hr and RPM for the outlet pump. Theoretically unity, it will vary with wear and tear and sensor drift.

Remember to make the level control loop *very* slow (30 to 90 minutes) (or more?), ramping the level setpoint and paying attention to the initialization of the level loop.

HTH. Interesting problem.


John G. Boland, president
[email protected]
Strateg!c Method$ Corporation
One Parker Square Suite 408
2525 Kell Boulevard
Wichita Falls, Texas 76308
940.723.1478 fax