speed measurment

khalil

Member
Join Date
Jan 2003
Location
Templestowe
Posts
176
hi ,

can any one tell how to measure speed by using a rotary encoder(incremental) , i have a S7 200 PLC, i have no idea how to do that,
any help will be great .

thanks in advance.

khalil i khalil . 🔨
 
In general, there are two methods. The first is to keep track of counts over a fixed period of time (counts per timebase). The second is to keep track of the elapsed time to accumulate a fixed number of counts (time per count).

Most PLC high speed counters include speed measurement capability.
 
how can i do that ?

hi steve ,

thank's for the reply,how can i do that let say i have 10 ppr encoder
and i wana measure the velocity of a motor,do you mean that i should count pulses in a specified amount of time (on delay timer?) or what
please steve this is my first time doing something like that,so ,more details will be appriciated,thank you again .

🍺

best regards.
khalil i khalil .
 
1'st get some timer for time interval:
UN M 0.0
SE T0
KT 10.1
***
U T0
= M 0.0
NW3***
UN M 0.0
SPB=over
L Z0 : counted pulses
T MW1 : For display impulses/sec or what ever
R Z0 : Counter
over:***


2'nd Count up pulses to Z0 from one channel of inc.encoder if you can be sure that direction is ok. You can do everything from NW3 to Z0 counter inputs also.
 
Last edited:
OK Khalil, let's use your example of 10 PPR on a motor turning at 1200 RPM. That's 20 revolutions per second, 200 pulses per second.

Using the first method (pulses per timebase) set up a one-shot that gets triggered every 100 milliseconds. You also need a counter to accumulate the pulses. Each time the one-shot gets triggered, transfer the accumulated count to a work register. This value has units of counts per 100 milliseconds. Multiply it by 600 (100 milliseconds per minute) and divide by 10 (counts per revolution) to obtain RPM. For example if you accumulate 20 counts in 100 milliseconds your speed is (20 * 600)/10 = 1200 RPM.

Now you can reasonably expect to see a variance of at least plus or minus one count per sample period. 19 counts would result in a calculated speed of 1140 RPM. 21 counts gives you 1260 RPM. If you need to measure more closely, you need more counts per revolution or a longer sample period.

Say you use a sample period of 250 milliseconds. Now 1200 RPM is 50 counts per 250 milliseconds. 49 counts in 250 milliseconds would give you 1176 RPM; 51 counts gives you 1224 RPM.

Using the second method, lets say you keep track of the time to acculmulate 50 counts. You set up a counter with a preset of 49 that resets itself. You also set up a timer that's always timing. Each time the counter reaches it's preset, copy the timer's accumulated value to a work register, and then reset the timer.

Fifty counts equals 5 revolutions, so the timer value has units of milliseconds per 5 revolutions. You divide 60000 (milliseconds per minute) by the timer value, and multiply the result by 5 to get RPM. In this case, your timer value can be no more accurate than the PLC's scan time. If your scan time is 5 milliseconds then you could conceivably measure as much as 255 milliseconds for 50 counts even if the motor was running at a constant 1200 RPM. 255 milliseconds would give you a calculated speed of 1176 RPM.

This brings up an important point about trying to bring encoder pulses into a PLC through a standard discrete input. The example I've been using (10 pulses per revolution at 1200 RPM) gives you one pulse every 5 milliseconds. Assuming that the pulse train is a perfect square wave, that's 2.5 milliseconds on, 2.5 milliseconds off. Your PLC scan time has to be faster than that to be able to avoid missing any pulses. It should be at least twice as fast. If the PLC is not fast enough, then you need to use a High Speed Counter module, which, as I mentioned before, will probably do the speed calculation for you.
 
Oops again

Steve Bailey said:

Using the second method, lets say you keep track of the time to acculmulate 50 counts. You set up a counter with a preset of 49 that resets itself. You also set up a timer that's always timing. Each time the counter reaches it's preset, copy the timer's accumulated value to a work register, and then reset the timer.

The timer should not be reset either for the same reason as my earlier post unless one can be sure that the 1 millisecond couters are reset exactly on the millisecond and no fractions of a millisecond are lost. The timer should be allowed to run free and uses the difference between times. This way no error accumulates. I know, picky picky.
 
Re: What happens if...

Peter Nachtwey said:
the counter increments by one between the time the counter is read and the time the counter is reset?

Count input is dynamic (front edge of encoder input) , so it have counted to result when Counter reset happends by M 0.0.
The Counter Z0 counts again next positive edge of encoder input.
 
thank you guy's

hi ,

thank you all guy's for your support ,the given information was perfect . 🍺

best regard .
khalil khalil .
 
Last edited:

Similar Topics

Does anyone know what the data transfer rate for this series of CompactLogix PLC's? 1769-L24ER-QB1B to be exact. Cheers.
Replies
1
Views
88
Hello, I am trying to setup on plc so If I enter 60 jph (job per hour) it will send the vfd hertz based on what jph is entered by...
Replies
2
Views
152
Sigh, DeviceNet noob... I have a 1756-L55, with a DeviceNet module, and 10 PF700 all commanded with DeviceNet. One of the PF700's blew up...
Replies
3
Views
128
Do i have to use interrupt subroutine, or immediate read high speed input, for Unitronics Samba plc or reading only the correponding register in...
Replies
2
Views
121
Hi all, I'm having trouble solving a problem I've been working on for several months, and thought you might like a stab at it. The machine runs...
Replies
22
Views
921
Back
Top Bottom