Parts Per Minute calculation

Clay B.

Lifetime Supporting Member
Join Date
Jun 2005
Location
Concord,NC
Posts
1,304
Here is what I am working with and what I need to do.

I have a machine that runs at a top speed of 60 parts per minute. What I need to do is display this speed. The machine pulses a prox on every cycle.
I am using a DL-06 PLC. What I have tried is to start a timer and reset it every time my prox transistions. I take this value and divide it into 60 to get my cycle speed. This should work buy when I change speed it gpoes haywire at really slow speeds. After my math cal I can end up with 2 and 3 digit numbers.

I looked on the AD web sight for examples. Found an example on using a HSC to figure RPM. Down side for me is my slow cycle so I am not using an enocoder so this example does not really help me any.

Has anybody ran into this before and could point me in the direction I need to go.
 
I would use a counter to count the pulses and reset it with the timer. put count in vmem. Multiply X time factor. X pulses in x time. if you set timer to say 2 sec. multiply pulses by 30 to get cycles per min. If timer is at 5 sec. multiply by 12. ect..
 
I agree with djbilly, it's going to be easier to accumulate count over a set time period. Unless you actually care about the time variations between each part you'll be fine accumulating. So make a counter that counts that input. Then make a timer (say 1 second) which loads the counter value to a Vmem and then clears the counter back to zero. Each second the Vmem is updated with the last seconds part count. If you need more accuracy (sacrificing update rate) then just accumulate over a longer time.
 
Clay B. said:
Here is what I am working with and what I need to do.

I have a machine that runs at a top speed of 60 parts per minute. What I need to do is display this speed. The machine pulses a prox on every cycle.
I am using a DL-06 PLC. What I have tried is to start a timer and reset it every time my prox transistions. I take this value and divide it into 60 to get my cycle speed. This should work buy when I change speed it gpoes haywire at really slow speeds. After my math cal I can end up with 2 and 3 digit numbers.

I looked on the AD web sight for examples. Found an example on using a HSC to figure RPM. Down side for me is my slow cycle so I am not using an enocoder so this example does not really help me any.

Has anybody ran into this before and could point me in the direction I need to go.

Seems to me that if your calculated value is in terms of minutes THEN set your timer and counter based on one or more minutes. IF you set timer for two minute or more then you could do running average for the last minute (maybe using a one minute timer). The other timer could be for an hour even so that you get an average value of parts per minute for the last hour.
 
He's only talking about 60 per minute max and maybe less. To have any accuracy an 'accumulate parts over time' would probably have to be at least 30 seconds to have any usefulness.

At that rate I would use a hundreth of a second timer. have it running all the time. Just before it (in ladder logic order) one-shot the occurance of a part. If the timer accumulator is greater than 0 (prevent a divide by zero error) then divide K6000 by the timer accumulator. That's your PPM. Also reset the timer.

Here is a fragment showing this:

PLC 05
// Rung 1
// Address 0
STRPD X0
OUT C0
// Rung 2
// Address 2
STR C0
AND TA0 K1
LD K6000
DIV TA0
OUT V2000
RST T0
TMRF T0 K6000
// Rung 3
// Address 12
END
// Rung 4
// Address 13
NOP

#BEGIN ELEMENT_DOC
"X0","Input","",""
"C0","Input One Shot","",""
"T0","Space Time","",""
"TA0","Accum Time","",""
"V2000","Rate PPM","",""
#END
 
If you want a fast updating rate counter, take a look at this.

It is for SLC, and I can't open it, but I think it has been tested... to do what you want...

In a SLC, the trick is to carefully place your order of operations to prevent resolution loss for an accurate and stable respons with few samples...



Pieace...

EDIT: Attachment is reall Rate_Counter*.RSS, manually change it from *.TXT
 
Last edited:
bernie_carlton said:
He's only talking about 60 per minute max and maybe less. To have any accuracy an 'accumulate parts over time' would probably have to be at least 30 seconds to have any usefulness.

At that rate I would use a hundreth of a second timer. have it running all the time. Just before it (in ladder logic order) one-shot the occurance of a part. If the timer accumulator is greater than 0 (prevent a divide by zero error) then divide K6000 by the timer accumulator. That's your PPM. Also reset the timer.

Here is a fragment showing this:

PLC 05
// Rung 1
// Address 0
STRPD X0
OUT C0
// Rung 2
// Address 2
STR C0
AND TA0 K1
LD K6000
DIV TA0
OUT V2000
RST T0
TMRF T0 K6000
// Rung 3
// Address 12
END
// Rung 4
// Address 13
NOP

#BEGIN ELEMENT_DOC
"X0","Input","",""
"C0","Input One Shot","",""
"T0","Space Time","",""
"TA0","Accum Time","",""
"V2000","Rate PPM","",""
#END

Thanks Bernie Carlton. That is how I had it programed this morning. I thought it was correct but I kept getting weird answers.
I think I need to take a closer look at my code and see if I can find the problem. It had me stumped this morning and I was second guessing what I was doing.
 
bernie_carlton said:
He's only talking about 60 per minute max and maybe less. To have any accuracy an 'accumulate parts over time' would probably have to be at least 30 seconds to have any usefulness.

At that rate I would use a hundreth of a second timer. have it running all the time. Just before it (in ladder logic order) one-shot the occurance of a part. If the timer accumulator is greater than 0 (prevent a divide by zero error) then divide K6000 by the timer accumulator. That's your PPM. Also reset the timer.

Here is a fragment showing this:

PLC 05
// Rung 1
// Address 0
STRPD X0
OUT C0
// Rung 2
// Address 2
STR C0
AND TA0 K1
LD K6000
DIV TA0
OUT V2000
RST T0
TMRF T0 K6000
// Rung 3
// Address 12
END
// Rung 4
// Address 13
NOP

#BEGIN ELEMENT_DOC
"X0","Input","",""
"C0","Input One Shot","",""
"T0","Space Time","",""
"TA0","Accum Time","",""
"V2000","Rate PPM","",""
#END
Absolutly correct, I just did the same thing last week with a .rss program reseting a bit shift with a OSF command to verify the BSL worked and there was no annomolus data......slighlty diferent problem, but a very simular solution, I can't post the code, as I am on my blackberry, but it will be very easy to do in DS5....if you need help email me at [email protected]
 
I take this value and divide it into 60 to get my cycle speed. This should work but when I change speed it gpoes haywire at really slow speeds. After my math cal I can end up with 2 and 3 digit numbers.
(1)....runs at a top speed of 60 parts per minute.

Okay, say the speed is really = .01 part per minute.

(2) I take this value and divide it into 60 to get my cycle speed.

60 / 0.01 = 6000 parts per minute! Obviously this cannot be.

(3)... but when I change speed it goes haywire at really slow speeds. I can end up with 2 and 3 digit numbers.

Yes, it is calculating what you told it to do, but not what you want it to do!
 
Lancie1 said:
(1)....runs at a top speed of 60 parts per minute.

Okay, say the speed is really = .01 part per minute.

(2) I take this value and divide it into 60 to get my cycle speed.

60 / 0.01 = 6000 parts per minute! Obviously this cannot be.

(3)... but when I change speed it goes haywire at really slow speeds. I can end up with 2 and 3 digit numbers.

Yes, it is calculating what you told it to do, but not what you want it to do!

When I say it is less than 60 parts per minute I know this because I can measure the cycles with a stop watch. At the time we were testing the cycle counter we were running around 30 parts per minute or 2 seconds between cycles. THat is plus or minus the .1 to.2 seconds it takes your brain to tell your finger to push the button.

Since we have several other issues with this machine to get fixed we have not gotten back on the cycle rate issue. I will post what I find.
 
Peter Nachtwey said:
The answer is out there.
Yes, DickDV, I am letting them "wist in the wind".

Thanks Peter, hope my bloomers are not showing while I am flapping in the wind.

I guess I can assume from your responce the answer is painfully obvious.

Anyway, have bigger fish to fry right now so I need to get to those. Will let you know what I find in the wind.
 
Perhaps the input signal is not clean and you are getting bounces. These may possibly be ignored/missed at higher speeds but show up as two individual ones at lower speesds resulting in a momentary high rate reading. Add acounter to check this thory.
 

Similar Topics

Hi All, Could anyone give me some pointers of how to calculate the parts per min, on a simple semi auto machine, using S7 300 PLC and a...
Replies
5
Views
6,553
I have one customer that i programmed a parts per minute display. I used without much thought on my part the "number of parts per time period"...
Replies
5
Views
6,790
Does anyone have any logic for Allen Bradley for parts per minute, and rolling averages. Im trying to write logic for uptime / downtime /...
Replies
6
Views
5,333
What is the easiest way of programming a omron plc to calculate parts per hour :D .The value will be displayed on seven segment displays
Replies
14
Views
5,220
I am looking at an application where I will need to detect small hairline cracks in stamped metal parts. The sensing will need to be done in the...
Replies
10
Views
1,059
Back
Top Bottom