Advertisement Jump to content
Sign in to follow this  


This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'll state up front that this isnt game related. It is programming and math related however, and there are alot of bright individuals here, so it seems a good place to troll for oppinions and advice. I'm building (or rather have built) a device to create torque and power curves for small electric motors. Basically I'm interested in seeing how different wind configurations and numbers and such effect the power output for use in small R/C cars. The makeup of the device is a disc or cylinder with known inertia about its axis which is attached to the motor to be tested. There is a photo eyeball sensor dealy that looks through holes in the disc. The input then, that I have to work with, is a single pin state. on or off. Either it is looking at a hole, or a 'spoke' of the disc. Now then, how should I go about extracting a power and torque curve from this? In version 1 of the device I did the following with a simple console app. 1) The app would run as fast as it possibly could. No frequency limitations or anything. 2) When it saw a spoke of the disc, it would begin timing. 3) When it saw the NEXT spoke, it would stop timing. 4) From the amount of spokes I could calculate the angular rotation over that recorded time period, and get angularVelocity (convert to RPM) for that tiny fraction of time. 5) It would repeat this and plot the RPM vs Time to a file. 6) I inputted that into a complicated excel spreadsheet to get the torque curve, and from that, the power curve. This has alot of disadvantages for various reasons, most of which stemmed from excels inability to do calculus (that I know of) and the variation in RPM range of different motors. It was difficult to create a template spreadsheet that was 'plug and play' for all test subjects and thus it took forever to get the curves I wanted. So.... (I know that was a long intro..bear with me) I want to create a program that outputs the actual torque and power values, which I could then simply graph in excell. This is where I need suggestions as to the best way to go about doing this before I dump the time into programming it. I tried using an opengl app as I've used them before, but it is linked to the monitor refresh rate. It will easily "miss spokes" if it only checks the pin state at 100hz. Typical motors run upwards of 30,000RPM. If there are only 2 spokes that is 60,000 of them going past the sensor per minute. Or 1000/s = 1khz. I figure I would need at least 10khz update frequency then to assure spokes dont get missed between updates, no? I'm using QueryPerformanceCounter which on my machine appears to be good to 3.579545MHz, so that should be sufficient. Can a traditional "decoupled fixed physics rate" approach allow me to check the pin state at a very high frequency while still allowing me to draw a graph of what is happening and displaying various data during the test run? If so, does anyone know of any good articles on how to implement such a thing? (as a side note, does anyone know how fast you are allowed to 'check' a parallel port? I couldnt find any mention of its update rate or whatever when I researched how to actually read it). I'm concerned that each time it draws a frame it will cause a spike in the actual data aquisition part. How should I get the actual curves? Currently I take the derivative of the RPM vs Time graph to get acceleration. Then factor in Inertia for torque and plot that vs rpm. Would it be better to maybe check each frames new angularVelocity value with the last one, and create the torque value from that? Perhaps it just works out the same in the end...? I know thats ALOT of questions and things. I didnt think this would end up being so long. I appreciate any advice, links, etc.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!