eccan

last 10 pcs average cycle time

10 posts in this topic

Hello All Does anyone have a simple way to calculate the average cycle time of the last 10 parts ran, doing a live update every part? I am using Logix 5000 and my machine makes a part every 4.0 - 6.5 seconds. I want to add the last 10 cycle times, then use that to calculate the average time. I am going to experiment with a FIFO a bit, but if there is an easier way, please let me know Thanks

Share this post


Link to post
Share on other sites
Use a ten element array and a counter as a pointer. Each part increment the pointer to the next spot in the array. When you reach the last element reset the pointer back to zero. Use the file average instruction AVE to average the array. Start with counter.Acc = 0. Counter preset is 10 Each time a part is complete then { Save the part time in the array at data[counter.acc] Increment the counter (increment after you save the data, not before) If counter.dn then reset the counter } AVE data[0] 0 AVERAGE_TIME AVE_CONTROL 10 0 Here is a post where its discussed but for a micrologix. Edited by Alaric

Share this post


Link to post
Share on other sites

Edit: - for a much larger number of items to work with Alaric's method is much less wasteful of system resources. But for only 10 then this is probably ok. 1. Prepare an array of DINT 10 long (example Average_Array - set dimension to 10 - you get Average_Array[0] through Average_Arrya[9]) 2. Once you have a new inter-case timing use COP to move Average_Array[1] through Average_Array[9] to Average_Array[0] through Average_Array[8]). We have to do the COP this way or they will overwrite themselves. 3. Move your just acquired timing to Average_Array[9] 4. Now use the AVE command to average the ten entries into a DINT called Timing_Average. Create a 'control' variable called Average_Control. Your rung should look something like the attachment

post-2274-1233273370.jpg

Share this post


Link to post
Share on other sites
There are some other tricks to doing this. If you are storing each individual item time, a circular buffer eliminates using FIFO's. A FIFO actually physically copies every location on every execution, which is slower than a circular buffer that simply moves locations around. Some other ways to skin this cat: If you keep a running total of the last 10 items (for your average), you can just subtract the oldest and add the newest. This eliminates recalculating the other 8 items. This solution is scalable to any size. If you just want a moving average, then you can use MA=0.9*MA+0.1*(new item). This usually works just as good as a true running average in practice and is much more efficient to calculate. Alternatively, you can combine the above two. Average=Average-0.1*(old item)+0.1*(new item)...effectively removing the effect of the oldest item, followed by adding the effect of the newest one. This avoids doing the division implied in the first alternative (division is often much slower than multiplication). If the items are produced one after another with no pauses in between, you just keep the time stamp (in seconds) of the items in the queue then you can simply subtract the oldest from the newest and divide by 10 to arrive at the result.

Share this post


Link to post
Share on other sites
After every cyce, average this cycle time with the average cycle time, that is add them and divide the result by 2 back into the average cycle time register. You may also determine before calculations whether the last cycle time is valid (filter out too long cycles resulting from stopped machine and too short aborted cycles). Invalid cycle time should forbid this cycle time participation in calculations.

Share this post


Link to post
Share on other sites
Thanks all I used b_carlton's idea and it works great. just 2 rungs of logic Thanks for everyone's ideas

Share this post


Link to post
Share on other sites
On 28.1.2009 at 0:54 AM, b_carlton said:

Edit: - for a much larger number of items to work with Alaric's method is much less wasteful of system resources. But for only 10 then this is probably ok. 1. Prepare an array of DINT 10 long (example Average_Array - set dimension to 10 - you get Average_Array[0] through Average_Arrya[9]) 2. Once you have a new inter-case timing use COP to move Average_Array[1] through Average_Array[9] to Average_Array[0] through Average_Array[8]). We have to do the COP th

B_calton. Where do I find the attachment 

Share this post


Link to post
Share on other sites
On 10/3/2020 at 0:53 AM, Hojland said:

B_calton. Where do I find the attachment 

It may have been lost on the site during the changeover. That far back it was probably on my work computer. I'm retired now (2016). I only have RSLogix 500 micro lite now. Sorry.

Edited by b_carlton

Share this post


Link to post
Share on other sites

I reported the post to alert a moderator to repair the link.

b_carlton, Belated congratulations on your retirement!

Share this post


Link to post
Share on other sites

The attachment has been repaired.  Thank you for reporting this @IO_Rack.  There was definitely a point when all of the attachments disappeared.  We have to fix them one at a time.  Please continue to report them when you spot them. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now