events per minute


Thread Starter

David McAnally

What is the best way to code an Allen Bradley 5/04 PLC such that parts/minute are calculated in the logic. The total will be displayed on an Allen Bradley Dataliner. Everything is in place and working. The Dataliner is displaying the proper message. I just need to send it the

I can figure something out, but I feel that are people who have done this before and know the best way to accomplish this.

Steve Bailey

There are two common ways.

First, you can measure the time between parts. Divide 60 by this time (in seconds) to get parts per minute. For example, if you measure 2.5 seconds between parts, 60 divided by 2.5 gives you 24 parts per minute.

Second, you can count the number of parts in a predefined time period. A short time period gives you a more frequent update on the dataliner, but is more susceptible to round-off error. For example, count the number of parts in ten seconds and multiply it by 6.
I have used a similar routine to monitor the rpm of a machine. I set up a timer with a 6 second period. Then set up two registers for the last count and the most recent count. I set up a third register to act as a counter and tie the input used to sample the parts to that counter such that the counter is incremented with each revolution (or part). Now, use an OSR with the timer DN bit and MOV the contents of the most recent count to the last count. Then MOV the contents of the counter register to the most recent count.

Next, you need to subtract the last count register from the most recent count register. Use greater than or equal and less than instructions to ensure you always get a positive number. The PLC I used (Unitronics)doesn't care if the counter overflows and "wraps-around" back to zero, but yours may. You may need to reset this counter if that is the case. The result of the subtraction operation is stored in a fourth register named delta count.

If everything is working properly, you will now know how many parts were produced in a 6 second time frame. Multiply that number by 10 and send to your display. Depending on how many parts/minute you're producing, the resolution may be too low for your application. (works nicely for RPM, though!) You can increase the resolution by increasing the time period and decreasing the multiplier. The tradeoff is update time for the display.