like that idea as well, will experiment with it tomorrow. once cycle starts, there is from 1.5 seconds to 2 seconds untill the cycle end signal goes true.
So, 1 / (1.75 seconds) = 0.5714285714 * 60 = 34.2857142857 cycles per minute
IronDesk said:
If i understand correctly what you are saying, once the cycle starts, start a timer, when cycle end signal goes true, move the timer value into a memory location. Do this for a few cycles, then add those values together and divide by the number of times you stored the value. does that sound correct? thanks to everyone,
Not exactly...I normally have a free running timer, in your case, .01 timebase, preset of 32767. No conditions, separate reset instruction later.
So, when the cycle complete bit goes true, i pass that through an inline oneshot (OSR or ONS depending on model!) to a bit.
This bit then triggers the storage of the accumulator, resets the timer, increments the FIFO (I use a COP instruction instead of the more cumbersome FFL/FFU pair) and updates the running average.
Sometimes, instead of just copying the ACC, I DIV the Tx:y.acc by a value with a Fa:b destination to typecast the operation, and give me cycles per minute for each and every cycle right off the bat. You need a DIV instruction anyway in order to turn seconds into minutes...
Often, though, knowing the duration of past cycles is more useful than knowing their "projected rate" which is what that gives you. Then you need to plan for rollover depending on the maximum totals your averaging logic must deal with, whereas, calculating a float cycles per minute for each object, and then averaging those, avoids the need to deal with integer rollover.
If the timer times out, you will have 327.67 second per product, so having some extra steps in cases where you're machine is down for longer than that duration will increase the accuracy. I normally just have a rung that CLRS my rate math if the DN bit is set, so I show "0.00 ppm" on the HMI instead of "0.18 ppm"...after machine starts, and with a rate of 30 per minute, and averaging the last three to five samples the on screen indicator will self correct in just a few cycles.
Methinks that for an operator feedback mechanism for a pot, you want to update the HMI immediately, if not Sooner, (no averaging, or do the averaging and show both...perhaps even allow the number of cycles for the averaging to be an operator adjustment.
Oh, the First in/first out stack is merely a COPy instruction.
I COP Fa:1 to Fa:0 with a LEN of 9 then I move the newest value into Fa:10, and average Fa: (10-number_of_samples) through Fa:10