Ping John Larkin, take 2

May 08, 2012 2 Replies

I can't be sure if my earlier post got buried, didn't go through, or nobody was interested, so I guess I'll try posting a second time!



I saw the thread you started on calculating turns ratio, and while it's not an "online tool" exactly, I wrote this little script that you can run in the browser:

formatting link



It calculates a set of rational approximations to your desired turns ratio within a given tolerance and maximum number of turns, and sorts by them top to bottom by smallest absolute error. It uses a Stern-Brocot tree, which was a method used by clockmakers to determine gear ratios - essentially a type of binary search.



formatting link



Finding rational approximations for a given ratio is also possible via brute-force, but has a time complexity of O(n^2) in the number of turns. The Stern-Brocot algorithm has time complexity O(log(n)), so if you need to design a transformer with a million turns in a hurry it might be your best bet.


The results for your given turns ratio, less than 1e-6 absolute error and 10,000 max turns are:


6777/6193: absolute error: 1.61473e-08, relative error:1.47558e-08
4166/3807: absolute error: 2.62674e-08, relative error:2.40038e-08
2611/2386: absolute error: 8.38223e-08, relative error:7.6599e-08
1555/1421: absolute error: 2.11119e-07, relative error:1.92926e-07
1056/965: absolute error: 5.18135e-07, relative error:4.73485e-07

This one is online:

formatting link

Thanks. I don't have Python (or Perl) installed on my PC. I guess I should give them (another) try some day.

It's probably not feasible to inferr turns ration from measured voltages when the number of turns get past a hundred or two.

Given the speed of a modern PC, you could really do this by brute force. I've run useful FOR loops in PowerBasic at above 100 MHz. That could do all cases up to 10000x10000 in one second! Actually, the loop only has to run 10000 times, which could be done in milliseconds.

John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required