Usage Algorithm

robertmee

Lifetime Supporting Member
Join Date
Feb 2008
Location
NC
Posts
2,002
I have an application that I've done over the years that I'd like to improve upon if possible. I've always wanted to but time hasn't afforded me an opportunity to really investigate until now. The application in general is a contuous mixing from four tanks. These tanks have levels that are measured via probes (common wall tanks, so Load cells not possible). The material is granular so angle of repose is an issue to consider. In otherwords, level may not always indicate exact mass due to angle of repose. The angle changes also whether it was a recent fill or if it has been discharging for awhile.

Under normal circumstances, the tanks provide continously metered product, refilling from bulk storage as needed. However, on product changes, it is necessary to empty these tanks for new ingredients. It is preferable to empty them together so that every 'drop' is used. Each tank has a different usage rate so in order to empty them together, the starting levels of each must reflect these rates.

Historically, to accomplish this, when it has come time to empty, I set the refill/cutoff levels to a narrow preset band and in the correct proportion according to usage rate. Then just allow the system to refill as normal and when all tanks are within their level band, 'let it go' or empty.

The problem with this is I'm not sure that it is the most effecient. For example:

If the slowest tank is full, then we have to wait for it to get down to the band. Meanwhile, the faster tanks may take multiple refills to keep them going. Might not be a problem, but a condition to consider.

If all the tanks are below these bands when we start, then we are unnecessarily refilling them all back upto the bands. Of course there is any number of permuations of this condition.

We get into a semi race condition. We keep the refill/cutoff band as narrow as possible because we want the levels to be as close to where they need to be when we say 'go'. Of course, angle of repose sometimes effects this, but it is the best we can do. However, with the bands being narrow, there is lag in the system that causes unnecessary refills. Each refill from bulk storage may take 2 minutes to transport to the use tank. During this time, all tanks are using. By the time the material shows up for a given tank and satisfies its band, one or more tanks may drop out of their band due to normal usage. So, we have to fill the next one. Same thing could happen again. The system eventually hits the sweet spot, but I feel it is making unnecessary pulls. Remember the goal is when it is time to empty do it as quickly as possible.

So, if you are still reading at this point, that's pretty much it in a nutshell. I'm wondering if there is a better mathematical algorithm to accomplish this. Something where I determine the state of the system, fill a queue of all the refills and amounts that need to happen, taking into account usage rates, current levels, transport time and usages during that time. Once this queue exhausts itself, then empty.

Comments or thoughts? I've got to imagine its a fairly common scenario in continuous batching/mixing operations.
 
A lot of things aren't clear

robertmee said:
Under normal circumstances, the tanks provide continously metered product, refilling from bulk storage as needed.
There are 4 tanks with different material?
Is the meter in rate controlled?

However, on product changes, it is necessary to empty these tanks for new ingredients. It is preferable to empty them together so that every 'drop' is used. Each tank has a different usage rate so in order to empty them together, the starting levels of each must reflect these rates.
What controls the usage rates? Maintaining a rate proportional to the level makes sense.

Historically, to accomplish this, when it has come time to empty, I set the refill/cutoff levels to a narrow preset band and in the correct proportion according to usage rate. Then just allow the system to refill as normal and when all tanks are within their level band, 'let it go' or empty.
If you can control the meter in then why not add the minimum necessary based on the ration of the feed rates. This way you don't add any more than necessary.



The problem with this is I'm not sure that it is the most effecient. For example:

If the slowest tank is full, then we have to wait for it to get down to the band.
Yes, buy how does the slowest tank get full if you can control the meter in?

We get into a semi race condition. We keep the refill/cutoff band as narrow as possible because we want the levels to be as close to where they need to be when we say 'go'. Of course, angle of repose sometimes effects this, but it is the best we can do. However, with the bands being narrow, there is lag in the system that causes unnecessary refills.
It would be better to just refill so the ratio is maintained but you must be able to control the meter in rate for each tank.

Each refill from bulk storage may take 2 minutes to transport to the use tank. During this time, all tanks are using. By the time the material shows up for a given tank and satisfies its band, one or more tanks may drop out of their band due to normal usage. So, we have to fill the next one. Same thing could happen again. The system eventually hits the sweet spot, but I feel it is making unnecessary pulls. Remember the goal is when it is time to empty do it as quickly as possible.
The answer is obvious. Don't add more than is necessary.

So, if you are still reading at this point, that's pretty much it in a nutshell. I'm wondering if there is a better mathematical algorithm to accomplish this.
Yes, this isn't any different synchronizing axes. Often a motion controller gets used to extrude and mix different materials a precise ratios. It is the limitations, quantizing, of adding stuff in batches that messes up the plans. It should be possible to compute how much material is needed to be added and when at any time.

Comments or thoughts? I've got to imagine its a fairly common scenario in continuous batching/mixing operations.
Do you know the usage rate of each tank? Do you control the mixing rate from each tank. It this mixing require something like tank A 10%, tank B 20%, tank C 30% and tank D 40%. If I had control of the meter in then I can compare the three tanks on the level. For instance, using the percentages above I would multiply tank A's level by 10, tank B's level by 5, tank C's level by 3.333 and tank D's level by 2.5 and compare the result. The problem will occur if tank A's level result is lower than the others and material must be added. The amount that must be added needs to take into account the scaling and you simply can't dump a lot of material into tank A. You must be able to add material is smaller amounts to those tanks that empty slowly.
 
Peter,

Thanks for the feedback....I think most of your answers come to a couple of clarifications:

Yes, it is four tanks with different materials and the usage rates are known. They are relatively fixed, although there is some minute variation due to leakages. So, in your example, it is accurate to say that Tank A uses 100 lbs per minute, Tank B uses 75 lbs per minute, Tank C uses 60 lbs per minute and Tank D uses 40 lbs per minute. That's a constant useage that never stops until the tanks empty on product change.

The refill is another story. I do have control over the amount of refill and when it is refilled but it is not a continuous refilling process, more of a batching process. The bulk silos are typically located in a remote location. The usage tanks are actually not a single ingredient but a mixture themselves. So when a refill is necessary, several bulk silos remotely open in correct proportions, mix several ingredients and then via conveyors and elevators deliver the mixture to the 4 use bins. This transport/mixing can take anywhere from 1 to 3 minutes depending on the facility and transport time (how far away the silos are). These are 400 Ton silos so moving them closer to the plant is not an option :)

When a usage tanks needs a refill, the bulk density of the material is known, the level is known and the volume of the tank in relation to level is known. From that, I know how much mass to bring over. If I need 400 lbs of material to satisfy the refill, the remote silos provide this material through conveyor mixing, and then the material is transported via conveyors to the usage tanks. From the time I realize material is needed until the time it is delivered is the 1 to 3 minutes mentioned above. The transport system may be 3 minutes long. I can bring over very small amounts and it is possible to have 3 different mixes in transport at the same time with gaps on the conveyors. The gaps allow for positioning of a feed spout to the appropriate useage tank. However, the more smaller mixes, the more inefficient the system becomes as you are now populating the conveying system with gaps instead of material.

Note this is all happening at very fast rates, if that wasn't clear. It is quite possible that with a small amount of mixture brought over that the same amount is used in the time it takes to get over, resulting in no net gain.

Oh, I missed your one question. The slowest tank 'could' get full from operator carelessness. I get what you are after and yes, I typically try to maintain the operating levels at the correct ratio to begin with. But, due to the speeds involved and the likely condition that an upset could occur on the delivery system, the operators during steady state usually like to have full tanks to act as a buffer. They don't realize that the system is only viable for as long as the fastest user is full.

Does that help clarify?
 
Last edited:
This transport/mixing can take anywhere from 1 to 3 minutes depending on the facility and transport time (how far away the silos are). These are 400 Ton silos so moving them closer to the plant is not an option :)
The answer seems simple enough. The levels must be predicted 1 to 3 minutes into the future. You need to keep track of two quantities for each tank. The amount in the tank, you do this already, and the amount in the tank and on-the-way. This needs to be a continuous process that is always being update. Now what still isn't clear. Can all four tanks be filled at a time or do they share the same filling supply. If all four tanks can be filled at the same time then calculating the level at some time in the future should be easy. If the filling mechanism is share then it become more complicated.
 
The answer seems simple enough. The levels must be predicted 1 to 3 minutes into the future. You need to keep track of two quantities for each tank. The amount in the tank, you do this already, and the amount in the tank and on-the-way. This needs to be a continuous process that is always being update. Now what still isn't clear. Can all four tanks be filled at a time or do they share the same filling supply. If all four tanks can be filled at the same time then calculating the level at some time in the future should be easy. If the filling mechanism is share then it become more complicated.

Only one at a time....the feed shares a common delivery system upto a rotary spout that is positioned over the correct bin when it is to be refilled.

That's why I was leaning towards a queued system. To whit:

Let's say it is time to empty. Take a snapshot of all the bins and determine some least refill algorithm that

A) takes into account which ones get filled

B) takes into account the usage rates of all tanks during the refill of any one tank

C) takes into account in what order of the queue it will be refilled. If it is the first one, then somehow take into account that it must get more material because it will continue to use as the remaining tanks are filled.

The problem I see is that there appears to be too many scenarios to gracefully predict or account for.

Scenario A) all tanks are already there - yipee

Scenario B) the slowest user has too much material. Two possible subsets:

B-1) the ratios aren't such that the other tanks can be filled to accomodate because they would be overfilled. Must wait and then fill. Must also keep fast tanks running as it is possible that they run empty before the slow tank is low enough.

B-2) the ratios are such that the other tanks can be immediately filled.

Scenario C) all the tanks are too low. Easy to accomodate I think with the queue system. Fill the slowest one first, down to the fastest one, account for usage and transport times.

Scenario D) some tanks are too low. Some too high. If the slowest is too low, must refill along with any others that are low while accounting for the ones too high reaching their level at some point.

It seems that if somehow scenario D could be adjusted for all cases via some Karnaugh reduction map, that would the great. But I'm not sure that all exceptions could be captured under one unified rule. Might just have to brute force it on a spreadsheet to see where everything shakes out.
 
Last edited:
Only one at a time....the feed shares a common delivery system upto a rotary spout that is positioned over the correct bin when it is to be refilled.
I thought about it while walking. No big deal.

That's why I was leaning towards a queued system. To whit:

Let's say it is time to empty. Take a snapshot of all the bins and determine some least refill algorithm that

A) takes into account which ones get filled

B) takes into account the usage rates of all tanks during the refill of any one tank

C) takes into account in what order of the queue it will be refilled. If it is the first one, then somehow take into account that it must get more material because it will continue to use as the remaining tanks are filled.
Yes

The problem I see is that there appears to be too many scenarios to gracefully predict or account for.
The these problem scenarios must be avoided

Say there are two tanks A and B and tank A flows at 10%/min and tank B flows at 20%/min. If tank B is 80% full then tank A should never be filled to more than 40% full. More importantly if tank B is 80% full and another 30% is on the way then tank A should not have a combined tank volume and in transit volume of 55%.

There should be a minimum volume that each tank is allowed to get to. This would be based on the transit time and the usage rate. The tanks that are closest to being empty BY TIME should have the highest priority.

I have more questions.
1. Can there be material for more than one tank in transit at a time? If so you will need to queue up the amount and the destination.
2. If there can be material for multiple tanks in transit at one time then how much resolution do you have at adding material.
3 How time time between different groups of material must there be.

Lots of fun.
 
I have more questions.
1. Can there be material for more than one tank in transit at a time? If so you will need to queue up the amount and the destination.
2. If there can be material for multiple tanks in transit at one time then how much resolution do you have at adding material.
3 How time time between different groups of material must there be.
Lots of fun.

1. Yes. Depending on length of the transport system, there could be upto 3 different refills to 3 different tanks on the delivery system at once.

2. The dispensing system is very accurate in relation to the level in the tank. I have 1/2 lb/sec flow resolution. The use tanks are typically 5000 lbs or so completely full, operating range around 3500 lbs.

3. Typically 30 to 45 seconds. The gap allows for cleanout of material handling elevators (they tend to enlongate the length of the material on the conveyor due to their efficiency) so that refills don't overlap and enough gap to move the spout to the next tank when the material shows up. We don't move the spout until just before the material shows up to gain time and efficiency on the system.

I didn't quote your other proposal to not allow for exceptions. In otherwords don't let the system refill the tanks to where it is difficult to empty them. I understand your point completely and the system usually enforces the refill/cutoff levels for the tanks in proportion to their usage for that reason. The problem is as explained before the operator's tend to manually move the refill/cutoff setpoints around to their own likeing based on habit and preconceived idea. I don't think it prudent or even possible to enforce them not doing this, and so the system should really allow for any combination of levels at onset.
 
Last edited:
I didn't quote your other proposal to not allow for exceptions.
You are quoting this? OK.

The algorithm will correct eventually if the slowest tank is filled to the top. It is just that extra material will need to be added to the faster tanks until the slow tanks empties and there is nothing that can be done about that. If the operators hands are cut off the machine will work perfectly.

In otherwords don't let the system refill the tanks to where it is difficult to empty them. I understand your point completely and the system usually enforces the refill/cutoff levels for the tanks in proportion to their usage for that reason.
This is where an obnoxious "you screwed up alarm" would be handy. It should be obvious to anybody with half a brain that the slow tank shouldn't be loaded all the way to the top unless they know it will be emptied before the end of the run. I don't see how an operator could ever beat the look ahead algorithm.

The problem is as explained before the operator's tend to manually move the refill/cutoff setpoints around to their own likeing based on habit and preconceived idea.
Yeah, yeah, but don't they have better things to do than push buttons?

It will be interesting to learn how this turns out. Anyway you have a fun project ahead.
 

Similar Topics

Hello everyone! This is my first time posting, though I have been to this site a few times hunting for some random problem like we all do. I...
Replies
4
Views
168
Hi everyone I am using Winproladder software for programming FATEK FBs PLCs and in programming, we often use Timers for activation of the...
Replies
4
Views
568
Anybody have any experience using a tone generator on analog signal wires? Trying to locate two analog level sensors in an old plc5 panel that...
Replies
7
Views
993
Dear all, I have some query about the use of Timers in Fatek PLC Module by using WinproLadder Software. I am trying to use one timer instance in...
Replies
5
Views
1,245
Hello, I was looking for some advice. Is there functionality within WinCC (V7.5) to report , list or export all tags that have been used within...
Replies
0
Views
411
Back
Top Bottom