Sign in to follow this  
Followers 0
angeraer

Calculate RPM using a pulse for every cycle.

16 posts in this topic

Hello again, My next PLC programming problem for my windmill is the RPM. I need to connect the generator to the grid when the rotor does 80 RPM. When it's connected to the grid and the RPM drops to 70 RPM, I need to disconnect it. Now, how can I calculate the RPM? Is it possible to see the time between two pulses? Then I could make the math to see if it 'probably' makes x RPM? Or do I need to measure during x-seconds, count the pulses and then check with the RPM limits? But then I would only know the RPM after x-seconds, and again after x-seconds and so on... I don't know if anyone has already done this? My PLC is an Omron C200HX with only digital I/O modules. Thanks, Andy.

Share this post


Link to post
Share on other sites
Two ways of skinning a cat. First way, used with a low number of input pulses per rev. Have a high speed timed trigger (ie 20ms pulse) feeding a word increment Then for every pulse in; RPM = 60seconds / (incremented word * time of pulse), then reset the incrementing word. Second way, used with higher numbers of input pulses. Use a timed trigger (1second) and every time it turns on check how many pulses have been counted since the last time it turned on. Then multiply by number of triggers per minute (60 for 1sec pulse), then divide by the number of pulses per revolution. Reset the counter Hope this helps Ben

Share this post


Link to post
Share on other sites
I have one fiber optic sensor which can generate one pulse per revision. It's ofcourse possible to add an additional reflector so I get two pulses per revision. Can you tell me how I create this timed trigger? What do you mean with "time of pulse" in your first suggestion? Thanks, Andy.

Share this post


Link to post
Share on other sites
This program calculate the RPM for each pulse. One pulses per revision. The format is XXX.X rpm at D0

Share this post


Link to post
Share on other sites
Yair, Thanks for the solution. I've been in the hospital till now so I didn't have time to take a look at it earlier. I tried it, it does "something" but I completely don't understand what you are doing. specially the calculations... Could you explain me you way of thinking a little bit? Thanks, Andy

Share this post


Link to post
Share on other sites
I added some rung comments to this program. It is for CS1G-CPU42h but you can convert it to c200hx

Share this post


Link to post
Share on other sites
Yair, Thanks for the example with comments. This cleared things up! How did you get to this formula? If I try some examples the result isn't always 100% correct? I converted the time to centiseconds because the high speed timer works with 0.01 seconds. {[6000.00 CENTISEC +((REV TIME XX.XX CENTISEC)/2)] *10}/(REV TIME XX.XX CENTISEC)= XXX.X RPM example : REV TIME = 200.00 CENTISEC or 2 SEC {[6000.00 CENTISEC + ((200.00)/2)] *10} / (200.00) = XXX.X RPM {[6000.00 CENTISEC + (100.00)] *10} / (200.00) = XXX.X RPM { 6100.00 CENTISEC*10} / (200.00) = XXX.X RPM 61000.0 CENTISEC / (200.00) = 305.0 RPM It should be 300.0 RPM in stead of the 305.0 RPM? Thanks, Andy.

Share this post


Link to post
Share on other sites
You are right. The correct formula is: {[60.00 SEC)*10 +((REV TIME XX.XX SEC)/2)]}/(REV TIME XX.XX SEC)= XXX.X RPM I fixed the program now it is almost 100% I also add some AVR calculation. I think that with real plc and prox it might be 100% correct

Share this post


Link to post
Share on other sites
Just tried it, it didn't work, but maybe I missed something in the conversion. However, a friend of me gave me the following formula : 1 / [ Revision time / 60 ] I don't know if this is easy to do floating point maths in PLC. Andy.

Share this post


Link to post
Share on other sites
Hi I just check in CX-programmer for C200hx Floating point math is not availabel. Banker

Share this post


Link to post
Share on other sites
angerear, you already got some ideas from other members but using just digital I/O will result in some error due to plc scan time andslow i/o for example. what king of grid we are talking about? do you need to measure just RPM or phase angle as well? do you know how precise the RPM measurement need to be? what is possible damage/loss if the RPMs don't match freq. of the grid? would it justify investment into PLC hardware upgrade? at 60-80 RPM we are talking about 1 pulse per second. is this enough? how fast you need to shut it down? just asking...

Share this post


Link to post
Share on other sites
Panic, Well, first of all, it's a hobby project and we try not to spend too much money on it. Therefor I'm not planning on upgrading the PLC. To my opinion with a little creativity it should work just fine. The RPM question is more a formular question then it is a PLC question. I'm curious about how this is calculated since I can't find any solid answer on google. For my project the RPM calculation doesn't need to be perfect. If I get a value of 81 and it's 80 in real that isn't a problem. I've made some calculations using the blade and generator specs so I know that I need to connect the generator to the electrical grid (380v) at around 80 rpm. Once it is connected to the grid it will rotate at merely the same speed due to the characteristics (freq) of the grid. If the windspeed/rotorspeed drops below for example 60 rpm I need to disconnect. It could cause damage if the RPM would be 100 and it would then connect to the grid. The generator would then slow down a lot at once so that the blades could possibly brake from the rotor! So as you see it's not a difficult task that needs high precision. This RPM calculation is also needed to calculate the wind speed. The maximum number of pulses a minute would be around 300, so I guess the PLC cycle time etc can handle this as well. This is only to see if the wind is to hard to enable the brakes. I also asked this question here because of lack of PLC knowledge and it's my only resource for help. And with this help I already managed to rotate the nacelle into the wind using a PLC! Thanks, Andy. You can see some pictures of the project

Share this post


Link to post
Share on other sites
You could probably make a calculation with integers as well. Just try to make sure to try to make all the multiplies first, and divides later (to know some numeric would be helpful for you). And look out for overflows etc! Possibly, you could let your numbers represent tens, hundreds, tenths etc. And I would recommend using the double-word math instructions as well, if possible, as you get more numbers to play with. It will be more work, yes, but certainly not impossible. Check out instructions ADD(L), SUB(L), MUL(L) and DIV(L). They should be the basis for what you need. EDIT: Sorry for the perhaps somewhat stupid questions, but DO YOU really need to calculate the RPM??? Couldn't you just measure the rotation time, and use that one instead? (60 RPM = 1 sec, 70 RPM = 6/7 secs, 80 RPM = 3/4 secs, 90 RPM = 2/3 secs, 100 RPM = 3/5 secs, etcetra). The only reason I can see for calculating the actual RPM value is if you wish to display it on some kind of display. If that's not a must, why then have it? Measuring times is a lot easier, even if you probably will have to make some averaging (in that case you would have had to with RPM values as well). Don't get me wrong - it is still totally possible to indeed calculate the value, I just don't see the reason for it... Edited by TERdON

Share this post


Link to post
Share on other sites
Well to be honest, I also don't see a reason to calculate the RPM besides displaying it on a screen (which I want to do later on). For now I'll stick with the rotation time to do the magic. Thanks for all the replies and examples! Andy.

Share this post


Link to post
Share on other sites
The most accurate method for determining the time for one revolution of the rotor is to use the SCAN(18) instruction to fix the PLC scan time to a known time that is slightly greater than the maximum scan time of the PLC program. Once this is known, simply increment a DM on each scan until the rotor prox input goes true. At this transition, move the data to another DM for use in computations then move zeroes into the previous DM. Now multiply the count that you just saved by the number of milliseconds per scan to give the number of milliseconds per rotor revolution. Divide 60,000 by the number of milliseconds that occurred during the one rotor revolution. This will give you the cycles-per-minute for the rotor.

Share this post


Link to post
Share on other sites
Algorithm is correct, yes, it would be a LOT easier to measure the revolution time by using a timer instruction and reading its present value (just set the SV to something really high and take that into consideration, probably a subtraction operation will be necessary too), though... Also, in both our suggested algorithm variations, you'll have to make sure that you won't have problems with overflows when the wind doesn't blow and it takes "for ever" until the pulse comes...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0