You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old March 14th, 2008, 08:43 AM   #1
Clay B.
Lifetime Supporting Member
United States

Clay B. is offline
 
Clay B.'s Avatar
 
Join Date: Jun 2005
Location: Concord,NC
Posts: 1,304
Parts Per Minute calculation

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.
  Reply With Quote
Old March 14th, 2008, 09:14 AM   #2
djbillyd007
Member
United States

djbillyd007 is offline
 
djbillyd007's Avatar
 
Join Date: Mar 2005
Location: Sevierville TN
Posts: 86
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..
__________________
He who dares wins
  Reply With Quote
Old March 14th, 2008, 09:33 AM   #3
OpZed
Member
United States

OpZed is offline
 
Join Date: Sep 2007
Location: USA
Posts: 51
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.
  Reply With Quote
Old March 14th, 2008, 11:09 AM   #4
leitmotif
Member
United States

leitmotif is offline
 
Join Date: Nov 2004
Location: Seattle Wa. USA
Posts: 3,680
Quote:
Originally Posted by Clay B.
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.
  Reply With Quote
Old March 14th, 2008, 11:16 AM   #5
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 5,384
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
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com
  Reply With Quote
Old March 14th, 2008, 11:23 AM   #6
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 7,936
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
Attached Files
File Type: txt RATE COUNTER_1.txt (27.5 KB, 386 views)
__________________
It's not all the variables I am most concerned with, it's the undiscovered constants.

"You can lead a horse to water but if he's got his head up his as$ he may die of thirst anyway."

Last edited by OkiePC; March 14th, 2008 at 11:26 AM.
  Reply With Quote
Old March 14th, 2008, 11:38 AM   #7
OpZed
Member
United States

OpZed is offline
 
Join Date: Sep 2007
Location: USA
Posts: 51
Ooops, sorry thought it was 60 parts per second. Yeah that would be a slow update rate!
  Reply With Quote
Old March 14th, 2008, 12:13 PM   #8
Clay B.
Lifetime Supporting Member
United States

Clay B. is offline
 
Clay B.'s Avatar
 
Join Date: Jun 2005
Location: Concord,NC
Posts: 1,304
Quote:
Originally Posted by bernie_carlton
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.
  Reply With Quote
Old March 14th, 2008, 02:58 PM   #9
widelto
Member
Colombia

widelto is offline
 
widelto's Avatar
 
Join Date: Jul 2005
Location: barranquilla
Posts: 1,790
try this:

it is a different brand of plc but it works for me.
Attached Files
File Type: pdf SLC_running_average.pdf (198.6 KB, 374 views)
__________________
My two cents.
  Reply With Quote
Old March 15th, 2008, 12:26 AM   #10
tacm
Member
United States

tacm is offline
 
tacm's Avatar
 
Join Date: Jan 2008
Location: usa
Posts: 105
Quote:
Originally Posted by bernie_carlton
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 tacmubuntu@gmail.com
__________________
"The sole end for which mankind are warranted, individually or collectively, in interfering with the liberty of action of any of their number, is self-protection. That the only purpose for which power can be rightfully exercised over any member of a civilized community, against his will, is to prevent harm to others. His own good, either physical or moral, is not a sufficient warrant." John Stuart Mill
  Reply With Quote
Old March 15th, 2008, 01:38 PM   #11
Lancie1
Lifetime Supporting Member + Moderator
United States

Lancie1 is online now
 
Lancie1's Avatar
 
Join Date: Jul 2003
Location: Alabama
Posts: 9,324
Quote:
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!
  Reply With Quote
Old March 16th, 2008, 06:41 PM   #12
Clay B.
Lifetime Supporting Member
United States

Clay B. is offline
 
Clay B.'s Avatar
 
Join Date: Jun 2005
Location: Concord,NC
Posts: 1,304
Quote:
Originally Posted by Lancie1
(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.
  Reply With Quote
Old March 16th, 2008, 08:02 PM   #13
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: Vancouver, WA, UMSA, United Marxist States of America
Posts: 5,912
This is entertaining.

The answer is out there.
Yes, DickDV, I am letting them "wist in the wind".
  Reply With Quote
Old March 17th, 2008, 05:55 AM   #14
Clay B.
Lifetime Supporting Member
United States

Clay B. is offline
 
Clay B.'s Avatar
 
Join Date: Jun 2005
Location: Concord,NC
Posts: 1,304
Quote:
Originally Posted by Peter Nachtwey
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.
  Reply With Quote
Old March 17th, 2008, 07:10 AM   #15
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 5,384
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.
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Need help on Citect Trend calculation part.. KevinPhoa LIVE PLC Questions And Answers 2 August 21st, 2007 03:22 AM
About Siemens Plc Scan time Calculation Unregistered LIVE PLC Questions And Answers 4 May 13th, 2005 09:09 AM
Philosophy of Equipment Error Recovery, Alarm recovery, and Re-initialization Hester LIVE PLC Questions And Answers 8 May 11th, 2004 07:40 PM
calculating parts per minute using S7 300 and a positioning cam kevin churchill LIVE PLC Questions And Answers 5 December 16th, 2003 02:17 AM
Parts per Minute Display jthornton LIVE PLC Questions And Answers 5 November 8th, 2003 08:34 AM


All times are GMT -5. The time now is 09:11 AM.


.