Filling problem

Sprayman

Member
Join Date
Jan 2020
Location
Chicago
Posts
50
Hi all,

Interesting problem today with a lot of constraints. Ive posted something similar but Ive made a good amount of progress since then.

Equipment:
Click PLC with Analog Card
Keyence FD-XS20 Flow meter with XA1 controller

I have been tasked with filling different size containers. For simplicity sake lets say 1 and 5 gallon jugs.

I am filling by utilizing a flow meter that takes a measurement every 50ms.

I am then reading these flow readings and calculating the volume produced every 5ms.

My equation looks like this. ([(Gallons/Hour)/3600] * 5ms) + volume = volume. volume being the current volume i am at starting at: 0 gallons.

And this somewhat works! My problem is that it is off by a decent amount. What happens is that my bottle overfills by lets say .25 gallons before it stops.

This points to my volume adder moving too slowly. So I reduce 3600 to around 3400 and it gets closer.

Any thoughts on why I would have to do this? The flow rate is variable but not by too much.


One other thing to consider. My setup is flow meter then shut off valve. So some of the liquid that is passed through the meter never makes it to the jug. but since I am overfilling that seems like it shouldn't be an issue.

Tried to bold the important stuff.

My overall question: I seem to think my equation is right. I feel like the reading and measuring time intervals might be coming into play. Any glaring information I am not taking into account? Any thoughts on how to do this better?
 
Right now you are calculating volume based off the flow rate, correct? Any way you can get an actual volume from the meter? Either from a pulse or via communications? If you can control with actual volume you would be way more accurate.

Also you have to take into account the volume of liquid that will flow into the container from the time you issue the stop command and the flow valve closes. There is a certain amount of time it takes to make all that happen and during this time liquid is flowing into the container.

You could put in a routine to register the volume that flows after the valve is told to close. Then put that number into your program to stop the flow at that volume remaining.

I deal with this loading trucks and rail cars all the time. The batch controller I use has a routine that has to be engaged where it will look at the next X (user entered) shut downs and average the amount of over/under run and adjust the final trip point to end at 0.


Good luck
 
I think I looked into the pulses but this model doesn't quite use that feature. I am actually pretty accurate when conditions are more or less the same between each fill. If I adjust the formula for a 1 gallon jug. I can get repeated results under .5% difference.

Heres a follow up question. Since 5 gallon would be the largest I would fill. Would adjust my equation to minimize the error scale down to my 1 gallon fills? or would that be a linear fix? What would be nice is if lets say my error on my 5 gallon was 1%. My error on my 1 gallon would be only .2%. But I think it would be more like if I fill over by 1% on the 5 gallon. I would fill under by 4% on the 1 gallon....not sure.
 
One thing to check is the position of the flowmeter these should be kept full & it makes sense to have a shutoff valve after the flowmeter, Ideally the flowmeter should be in a vertical position & kept full, or in a dropped leg, by that I mean a strait pipe that has four bends like an expansion kink to keep the meter full.
It may be that you need a head or air bubbles or only partly filled pipe will cause inaccurate readings.
I still think that pulses are the way to go & I'm surprised that it does not have this facility.
 
What is a realistic flow rate for the liquid in your application?

Your units are a little off for gallons/hr / 3600 * 5ms, this gives you units of gallons * miliseconds/seconds.

What is the scan time of the PLC?

How are you calculating 5 ms for when you do your calculation? Do you have 1 timer on a 5 ms loop or something else?
 
One problem that I had in an application like this is that I was using a turbine flow meter. These are great for constant flow, but my data was garbage for the low flow rate at the beginning and end of the process. The number of pulses / unit volume was flat when you were above the minimum flow rate, but below that you're on the steep part of the curve. My results were like yours....I could tune it in for one size container, but then it would not work for others. It looked like the only option was to use a coriolis-type device, but we never explored it further.
 
Hi all,

Spent the afternoon playing with it. Discovered a few things.

First, It does have pulse mode, I was looking at the wrong output channel. It also has an integrated flow mode which i have been experimenting with. Seems to work ok but about as ok as my code.

As far as the internal clock goes. On the click you can set a standard clock speed to 5ms. I chose 5 because it seemed to be running between a 1 and 3ms clock speed so to be safe i set it to 5.

For the calculation. I am converting 5ms to seconds. Forgot to add that sorry!

The position is an interesting concept! I have it laying flat right now. I am running fluid through it at about 3 GPM and its source is well above it so I think it should be full but i could be wrong. We would hopefully be running around 3-5 GPM.

I'll post more info tomorrow on the Integrated flow rate mode. My first test underfilled which was interesting. If someone could explain the pulse mode to me that would be awesome! As far as I can tell does it work like an encoder? So every "revolution" would equate to a certain volume of fluid?

Thanks!
 
I'd just use some code to calculate inflights.

This would half your error everytime it filled.

Would take into account lag in valves closing, fluid left in pipe after the control valve that can still run on.
 
Did you say what brand flowmeter? Endress&Hauser?

I echo that you should perhaps use the totalizator function and count pulses. One digital in, IIN immediate in or D-IN module RPI at 5ms.

For the flowmeter analog data, if you're on Ethernet/IP you could count on it by setting up that device as implicit I/O, unicast and setting your RPI time to 5ms as long as it doesn't fault the processor because it can update it's other IO.

If you're explicitly connected, there's little hope. You can only guess at your update rate with MSG instructions.

If you're serial - hopefully RS422 and not RS485 networked with a bunch of other stuff then same applies - no guarantee of message delivery time. All you can do it get your baud rate up as high as you can - if I remember RS422/485 will support up to 135,000.
 
Last edited:
Are you sure you are sampling every 5ms? If you use a PLC timer then the time is at least 5 ms. If the PLC get around to your routine every 5.5 ms then you overflow by 10%. Oops.
You need to look at the real time hardware clock.




This. The timer will always run expire at a time at least as long as its nominal preset, because the PLC detects the accumulator has reached the preset during a scan, which is almost always after the accumulator actually hits the preset value.


One way to lessen the timing error this would be to use a longer preset, because the scan-time-induced error would be a smaller portion of the preset value*, but then you risk a non-representative measurement at the timer expiry. I doubt it makes sense to have a timer preset smaller than the flowmeter update time, so try bumping the preset to 50ms and seeing if your error is reduced by something approaching a factor of ten



* another way of saying this is that there are fewer scan-time-induced errors during each fill.


There are other ways to get a more accurate delta time than using the preset. I realize the OP refers to click PLCs, but I assume something similar to e.g. A-B MicroLogix is available, such as the 10kHz free-running clock (status word s:4) and also the per-scan times (status word S:35), which can be acumulated on each scan - for that matter skip the timer and use those on every scan if the Click has summat similar.


Cf. (A-B ML1400)


https://literature.rockwellautomati...documents/rm/1766-rm001_-en-p.pdf#G32.1041360


https://literature.rockwellautomati...documents/rm/1766-rm001_-en-p.pdf#G32.1040005


I did some work on various timing approaches here, especially the images of plots here; again that is A-B but I suspect Click PLCs will have similar facilities.
 
It sounds like your shutoff valve is not quick enough so when you remove the open signal, it lets through some product before fully closing.

You may also have some line volume between the valve and the discharge of the fill line trickling out, even when the valve is fully closed.

The easiest (and IMO best) way to fix this is determine what volume you overshoot by every time and account for that in the programming. If you have an HMI talking to this PLC, I'd make it a setpoint, preferably with elevated permissioning.

Your valve should be open when the total is less than the setpoint minus this overshoot volume. Close the valve when your total is greater than the setpoint minus the overshoot volume, but keep totalizing until flow is lost. If the totalizer can't pick up this overshooting volume, you may have to just add the overshoot volume to the reported total and conduct regular verification of the overshoot volume

There are issues with this, of course. If your pressure upstream of the valve changes, so will your overshoot volume. If the valve is air-operated and this air pressure changes, same deal.

The ideal scenario does not necessarily remove any overshoot volume, but instead accounts for it. If you can change your piping, try to do so in a way that the flow meter can pick up on the overshoot volume. That way either an operator can tweak the volume or you can automatically adjust it with a moving average. I have done both and both work exceptionally well.
 
Last edited:
Definitely use the pulse, if it is pretty intelligent then you could set it up to give a pulse every x pints/litres or parts of, this way it will probably not need interrupts to read the signal but of course the more pulses per volume then the more accurate it will be. Not used the PLC you are using so not sure if it has high speed inputs but I'm sure it does. providing the pulse width/mark space ratio is slower than the PLC scan should not be a problem. You definitely need a valve after the pump even if to keep the line full, you can also add a fixed inflight time to allow for the valve to close. Another way is to have two valves, one for main flow and one for trickle flow in parallel. again you open both valves until say 0.4 gal before set point shut the main valve and keep the trickle valve open, shut the trickle valve just before amount same as setpoint to allow for trickle valve to close.
 
in our process, we have a variable valve that closes as the target weight is approached.
the valve is within 2 ft of the container and is located above the container.
we start shutting the valve at 75%. he closer we are to the target, the more the valve closes. at 95% the valve is open very little.


james
 

Similar Topics

Hi Dears i want to fill gaps between Trend's Graph. i referd to Citect Help And I tried Some Trend Parameters such as...
Replies
8
Views
2,320
Hey guys, We are facing an issue, Krones hotfill line, around 10-15 fillers out of 110 are overfilling the bottle. Please help us what can...
Replies
13
Views
538
Hi, I am just exploring the options to replace an outdated filling valve controller for a can filler. It has 78 filling valves and runs at max...
Replies
15
Views
4,531
Hi guys I am hoping you can help me. I want to use an Allen Bradley HMI and PLC to record information every time a Cask is filled to an SD drive...
Replies
8
Views
3,225
Hello, i am currently trying to create a plc programme from my Tia portal v16 for a package filling machine. But i am kinda new to the plc stuff...
Replies
48
Views
17,309
Back
Top Bottom