I am trying to find a reliable way to measure product output of some of our machines in real time.
Each machine uses a sensor to count products coming out and we currently use an online system to measure products/hour however these statistics are proving to fluctuate a lot and very unreliable being online.
It doesn’t help however that although the machines are set to operate at constant speed are stopped often to refill parts normally only lasting a few minutes but enough to change the rate output a lot.
My problem. We are having to guesstimate outputs from each machine to satisfy min and max outputs required for total production, often making slight adjustments on each machine to get it right
Solution. A formula or code block connected to a sensor that gives me the most reliable product/hour output at any given moment.
If I have understood you correctly (and feel free to let me know if I have not); your machine will output X number of items per Y sample period. and you want the products per hour at any given point.
To re-phrase a little, you want ot know “now” how many samples over the last hour.
So at 10:00 it would be the count of items from 9:00-10:00
at 10:09 it would be the count of items from 9:09 - 10:09.
So the count would then be a sliding window of 1hr back from “now”.
My first thought (without knowing actual numbers), would be an circular array of item creation timestamps where the early items get removed if older then 60mins and new items are added. This the number of items over the last 60mins would be the number of items in the array “now” assuming old items where just removed.
In this approach you would need an array big enough to hold the pure max number of items in an hour that could happen plus a buffer.
You could use a dynamic linked list, but there will be overhead in allocating and freeing memory, and depending on the number of items, you may still have an issue depending on hardware/memory.
If the item count is very high, you could count the number of items per time period. e.g.how many items per minute. this then leads to a fixed size array of 60 Counters indexed by the minute. the items per hour would then be the count of the items in the array. You could keep a running total, where you add new items and subtract old items before you overwrite that time slot.
I could go on a little, but need some feed back to fine tune the idea.
Let me see if I can fill in some of these gaps for you…
Average speeds can vary from 2000 to 4500 products per hour (per machine) but normally between 2500 and 3500
Total production across all running machines (normally 4 machines but can drop down to 3) needs to sit between 12500 and 13500 but ideally as close to the 13500 products per hour mark as possible.
Product output is pretty stable once set but we do have stops every now and then of up to a couple minutes at a time, maybe 5 time per hour (guessing). So have to allow for these somehow.
Ideally what I need is to be able to change the machine output speed and have the new rate adjust as quickly as possible to be able to easily adjust machines to try stay as close to our 13500 totally hourly target.
Hope this helps. Let me know if you need anything else
Im sure this is a stupid question from me not understanding the manufacturing process.
If you have 4 machines with max output rate @4500 then 4500 * 4 = 18000 units per hour, which is greater then the target of 13500.
So I assume there is a “cost”/overhead in just running all machines at max 4500 then stop for a rest once the quota has been meet. this more stops = less pause time at the end of the run.
So assuming its better if they dont run flat out unless needed…and just thinking out load for a 1hr run (so need to adjust some things for continious running over more then 1 hr.
Start all 4 at the ideal rate.
Get Counters for all 4 machines.
Subtract current counter from target count, i.e. get the number of items needed to complete/hit target.
Items per machine = Items to complete / running machine count e.g. 3 or 4
Adjust Items per machine to a “per hour rate” - or what ever unit you need.
Repeat at next interval.
So you would need to know how many machines are running.
eg. lets say we are 30mins into a 1 hr batch.
No down time up to this point, so 13500/2 = Completed Count of 6750
But now we have 1 machine down … so #Machines = 3
New Target = 13500 - 6750 = 6750
Per Running Machine = 6750/3 = 2250 per machine.
New rate per hour would be something like
2250 * (60/(60 - time passed))
2250 * (60/(60-30))
2250 * (60/30)
2250 * 2 = 4500 per hour rate to complete target on time.
So based on that above example, it kinda seems that 1 machine down can mean max output of remaining 3. This seems to hint you it could be better to have a higher base rate for all 4 to allow for some outages before the remaining cant meet the target.
Math my not be 100% yet, as Im just brain storming.
So the restriction comes from the indexing machine that all machines merge into only being capable of handling up to 13500 tubs per hours. Chiller temperatures can also reduce this max number.
So the idea is to stay as close to max 13500 or whatever the max is without going over it from however many machines we have running. It’s a juggling act.
Also slower run speeds mean less wear and tear, maintenance and repairs, or breakdowns.
So does my above seem reasonable?
The bit that jumps out for my example was, with 1 of the 4 machines down, the three remaining would need to be running at 4500 until the 4th come back online.
So if you had a 2nd machine down then your count for the hour would be down, as the 2 machines cant run any faster.
Can you go over exactly what inputs we have ?
i.e.
is there a count per machine, count at output (total) or both?
is there a machine up/down input ?
anything else of interest ?
Im thinking a quick simulation may be in order.
Possibly but we are getting a bit ahead of ourselves I think as far as what speeds etc we need to achieve as a total. Let’s wind this back to a simpler scenario. 1 machine.
What I am hoping to achieve is to setup a standalone sensor/device on the output of this machine that counts each tub coming out and gives me the most reliable hourly rate taking into account stops and slight settings changes in the machine at any given time.
Hi Larry
I have been looking at this thread with a little bit of interest for a day or so. Just butting in with an observation.
I think this is going to be your bogeyman. You might do it with some historical data but the minute you introduce some unknown (at the time) variables you start introducing errors with it. A lot of this depends on how much absolute accuracy you need.
A lot (about 60) of years ago we used to service a machine that checked the level of liquid in soft drink cans. Any that were low were removed rom the conveyor about 1 metre away with a blast of air. This had to be spot on as if the air did not hit the can dead centre it would spin and fall sideways. A devil of a thing to set up.All done with Valve relaxation oscillators for adjustable delays. At a maximum of nearly 600 cans per minute I might add.
Humans being humans the operators used to continually change belt speed. So as you can imagine nothing worked.
What I am getting at is I don’t see how you are going to successfully compensate for a machine stoppage by adjusting other machine belt speeds. Would be an interesting exercise. How do you get a daily total of production. The counts on these machines you are discussing would be pretty approximate at best. Could be possible I suppose but you would have to have a situation where changing belt speed does not upset anything else.
Cheers Bob
I really just need it to correct itself as quickly as possible. So if it’s down for 2 minutes it should adjust and settle within 2mins or close enough.. The same with the machine speed. Adjust the speed. Wait the shortest amount of time for a reliable reading make more adjustments and repeat if needed.
Pretty sure it’s just a maths formula but my maths expired some years ago now.
The best idea I can come up with on my own is some type of timestamped moving average over a short period of time say 1min multiplied by 60 to give an hourly rate.
Hopefully this helps the machine adjustments settle within 1 minute or thereabouts. I can live with up to a 2 minute wait to see a constant speed of need be.
I’m not sure if I need something else to offset the stoppages or if the EMA will smooth it out the same as the above or if I have to somehow add the stop time to the EMA window for the next reading then continue as normal
Either way the maths and coding abilities are a bit outside my scope so any help appreciated
Sorry for the delay in getting back to this one.
For some reason I thought you could all ready track the output. On this side others may have some good ideas. My initial thought was some sort of beam and sensor. As a single item passed, it will cut the beam and that cut is counted on the controller. This assumes the item is big enough to cut a beam that is not too low that it gets false triggers from something else on the belt. It also assumes that the items are in single file and a gap between them, big enough to allow the sensor to detect it. Keep in mind that you could count individual items or a “package” of items (as you would know the number of items in a package).
Im just thinking outload hear… for the real-time tracking and adjustments. For a single machine, I would do something like this.
1 hr * 60 mins * 60 seconds = 3600 So any array of 3600 elements would give a per second count which should be fine.
Keep a running total for the current hour, Keep a running total for the batch/run.
there are a few ways for the code, but at a very high level
you have a running total for the hour, that will be accurate to the last 60 mins. (i.e. 1 second)
you have a batch/run total so you know how many have been made.
Keep track of items in the Array For the current Seconds field from clock/time.
Add new items to the batch total
Add new Items to the per hour total
On second change… Remove old values from the hour total, clear (set to 0) the old second old second field.
Note: You could just sum the array and reset on each second change, but this needs to add 3600 items every pass, the above while a little more complex should have less ticks used on the controller.
So now you would have/know.
the target for the batch/run
the current amount made
the total amount made in the last 3600 seconds.
Current Rate = total amount made in the last 3600 (as this is over 1 hr)
Items to Make = Target - Current amount made
From here we can work out how much time left on this run, and work out the new rate to hit the target.
All the extra stuff is cool but all I’m really looking for help with the math or more so the coding side to be able to get just the hourly rate output based on a a sensor input taking into machine stoppages and adjustments
I believe the word “account” should be between “into” and “machine”. Is this correct?
I think without going into the fortune telling business at this hobby level you are only going to get answers to what is happening now and what has happened in the recent past. Like definitive data.
What you are apparently asking is some sort of prediction on what is likely going to happen in the near future. Some sort of clairvoyant system which at this level I don’t think you are going to get.
Most of the devices available to us mere mortals so far are only as good as the information given to them. So if you input mistakes the device will output mistakes.I don’t see any way around this at the present time .
I stress this is with devices I know about. I could have missed quite a lot.
In short You are going to enter your prediction of stoppages etc yourself. The devices available I don’t think can do this for you.
Cheers Bob
Hi Larry and all
I wonder if it would be easier to go about this in a “negative” sort of thought.
Run all machines at the required rate to produce required output.
Monitor each machine output which I believe happens now.
If the output of 1 machine stops for any reason (output falls to zero) increase the speed of the remaining machines by a predetermined amount to make up the shortfall.
If another machine stops increase the remaining machines unit Max output is achieved.
Reverse the procedure as machines come back on line.
Like an artist drawing something like a chair. Sometimes it is easier to look at the spaces instead of the solids.
Cheers Bob
Imagine we have 1 machine. I want to put a sensor on it that counts all tubs coming out of the machine connected to an Arduino to give the the hourly production of this machine at any given time taking into account any machine stoppages.
I just want help with the maths or code to give me the most reliable figure at any given time.
My main problem is overcoming the stoppages or adjustments.
If I set the machine just to give me the count of the last hour of products as a moving average and stop the machine. The machine will still show a speed for the next 60 minutes as the count/average reduces to 0. I need it to give me the 0hr speed as quickly as possible after stops, same with adjustments if I change the speed from 3000 to 2500 I need it to show me 2500 as quickly as possible
That is exactly what I am getting at. You cannot look forward. Just what is happening now and recent past. So you can only get data UP UNTIL THE MACHINE STOPS. Then you can modify numbers but you have to wait until the machine starts to estimate loss of production foe that period. Because YOU DON"T KNOW BEFOREHAND how long the stoppage will be.
Cheers Bob