Calculating the real RPMs from a motor

casT-

Member
Join Date
Aug 2008
Location
Porto
Posts
1
Greetings everyone.
I have an university project which i have to complete that is to implement a PID speed controll of an induction motor with a PLC. The PLC in question is a Siemens S7-200 and im programming in Ladder.
I am stuck with this step for some time,that is to measure the real motor RPM from the encoder. The encoder is an icremental one that outputs 1024 pulses by shaft revolution. To catch this pulses im using a high speed counter(HSC).
Im trying to get there using a 2 timer cascade that will toggle ON and OFF a variable for some desired time. The idea is: when this variable is OFF the HSC is OFF as its current value is set to 0; when the control variable is set to ON the HSC will count until the control variable is OFF again. At this time the HSC current value(CV) should be stored and the HSC is put in stop.
Now, dividing stored CV by the time the HSC has counted, we get the number of pulses per second(PPS); PPS*60=PPM(pulses per minute); RPM=PPM/1024. My difficulty is not in the math implementation, its in the HSC controll sequence.
I have done some routines for this but im having troubble getting correct measurements.
I would like to ask if there is a standard way (or an alternate way)to get RPMs from incremental encoders. I will be glad if someone can help me.

Best regards,
casT-.
 
I have zero experience with seimens, but I would do something like this:

Let the HSC keep counting and find out the number of pulses per PLC scan, and then divide that by the scan time.

The HSC value will roll over at some point, but as long as your logic executes at least twice as fast as that rollover occurs, then you should be able to detect the direction mathematically, and then compute the actual number of pulses that have accrued each scan.

Once you know how far the thing has moved in counts, and can correctly deal with the rollover, then it should be simple to figure out the rate including a sign for direction.

Some PLCs include a mechanism to execute code at a regular interval, which is often the preferred method to accomplish such a task.

If that is not readily available, then you can use a timer to calculate the duration between events.

I am sure some siemens gurus can give you more specifics...

Hope this helps, and welcome to the forum.

Paul
 
I am not going to do the work for you but will give you some pointers.

Look in the S7-200 manual, Chapter - S7-200 Instruction Set, Section - Interrupt Instructions. There you will find two methods the first using a timed interrupt so after a fixed time it will take a reading. The second method would be to cause an interrupt after the high speed counter HSC reaches a set value. An Interrupt is just what it sounds like, the PLC stops its normal operation and performs a separate piece of code, when that code is complete the normal program resumes. In the interrupt you want to store the current time and count, reset the timer and counter and set a 'Data Ready for Calculation Flag/Bit'. You might think that you should do the Revs calculation in the interrupt but you should always make the interrupt code as short as possible. When the normal program sees that the Data is ready for calculation it can do the Revs calculation and then reset the flag.

Bryan
 

Similar Topics

This application has a motor with encoder feedback that drives a linear actuator that moves in/out, and is at roughly 45 degs from horiz. As the...
Replies
19
Views
1,364
I need to keep a running pass/fail yield of the previous 5,000 parts produced. I have used this formula before to calculate average: AvgValue =...
Replies
6
Views
2,152
Does anyone know how to calculate the savings from now needing to run an air compressor all day? Basically I have a design that replaced 6 * 1"...
Replies
26
Views
4,828
I would like to refer to this document of which I used some data ...
Replies
1
Views
1,478
Seems like this should be a simple thing but I’m struggling with it. The basis is that I am trying to detect if a linear assembly is stopped or...
Replies
6
Views
3,094
Back
Top Bottom