0

Is there a tool to find the closest optimum preferred resistor values given a list of constraints?

For example I'm designing a filter but only have a few odd resistor and capacitor values to choose from and was trying to optimise for the combination of values that has the smallest difference from the parameters for the filter I've designed.

Currently as the set of resistors and constraints is so small I'm simply looping through every combination of component value and returning the values with the smallest total difference from the filter parameters.

This seems like a optimisation problem however it is non-linear so many of the tools such as google or-tools would not work.

Is there some tool that already accomplishes this goal?

Thanks in advance.

Alessi 42
  • 99
  • 4
  • 1
    I wrote something like that in QT in 2004. But it only does resistors. The problem I see would be that for e.g. a filter you would need the Z which is not an E12 or E24 value but depends on the frequency. – Oldfart Dec 07 '19 at 15:20
  • Yeah I was thinking of using it on circuits with a known topology to avoid having Z components as you can separate them into discrete components. Then simply optimising for something like f_c = 1/(2*\pi*r*c). So a program for optimising resistors could probably be adapted to work perhaps – Alessi 42 Dec 07 '19 at 15:31
  • Can't you do it in a spreadsheet application? – Transistor Dec 07 '19 at 16:58
  • @Alessi42 I have a large variety of thoughts, which go in somewhat different directions. Your question is currently too open for me to decide which thoughts may help better. Could you provide us with the example you are currently struggling with, to provide a concrete example that helps narrow my thinking more? What are the filter characteristics you are struggling to hit, what kind of filter is this, is it passive or active, and other constraints that you feel may be important. Otherwise, I just have too many thoughts which even include simulated annealing. So I'm thinking too wide, for now. – jonk Dec 07 '19 at 17:06
  • @Alessi42 Are you able to consider ***pairs*** of E-series devices? Triples? Etc. Let us know the constraints you have. Thanks. – jonk Dec 07 '19 at 17:23
  • @jonk I agree this topic is very open and I'm open to suggestions for where best to place this question. The system I was designing was a sallen key second order Butterworth filter for an active high pass filter as such I was setting the values of the capacitors in the filter calculating the required resistances then finding the closest available resistor values and putting these values back into my equations to determine how close that value is to my desired corner frequency. I am only considering single components and not pairs or triples to limit the search space. – Alessi 42 Dec 07 '19 at 17:45
  • My use case was small enough in scope that I could brute force all of the possible component combinations and determine which gave a value of corner frequency closest to my desired however it began my thinking to whether there already exists a solution to my problem that scales to larger problem scopes such as nth degree Butterworth filters – Alessi 42 Dec 07 '19 at 17:47
  • @Alessi42 The Sallen Key addition helps a great deal. (Have you read their TR-50 paper from 1954?) I'm reading into this the fact that capacitors don't come in the bewildering varieties that resistors do. Some things may still be important in such a design, such as the input impedance the filter presents. So I am beginning to see why you wondered if someone, in all these years since, hasn't just written a nice Sallen-Key bit of software for this. I wouldn't attempt it because I'm not savvy enough to know, comprehensively, every practical way a Sallen Key filter might be constrained. – jonk Dec 07 '19 at 17:56
  • @Alessi42 There are some interesting tidbits to be aware of, regarding the E series. If you take the square root of an E6 series value, such as \$68\:\Omega\$ you will find a new value, \$\approx 82\:\Omega\$ that is found in the next higher series, E12. The reverse also works, by squaring an E24 value of \$43\:\Omega\$ you find an E12 value of \$\approx 18\:\Omega\$. There are other considerations for optimization, though. So a good program would be very interesting to develop and useful. I'd work with someone (having long experience with Sallen Key) to achieve it, if that someone shows up. – jonk Dec 07 '19 at 18:03
  • @jonk I had come across this in my first attempts however due to some historical rounding differences from the calculated and actual E series values I decided against using calculated E series and instead a precomputed list however I'm willing to look further into this if I decide to look into the problem further. This question was an attempt at finding similar problems from which I could borrow a technique or solution to apply to this besides this specific Sallen key application as I was struggling to think of similar problems. It would be an interesting software project to work on. – Alessi 42 Dec 07 '19 at 18:11
  • @Alessi42 It would be interesting if made quite general. A general approach may use simulated annealing. Given time, this finds most optimal solutions and allows the user to supply an arbitrary function to optimize. But I suspect that perhaps 80% of the need could be supplied with an almost trivial program, since most folks doing Sallen Key designs haven't even read their paper and are just looking for something "easy" and "well discussed" on the web so that they don't have to think much. A solution for them would be almost trivial to write. (There's only a few, more obvious constraints.) – jonk Dec 07 '19 at 18:18
  • For Sallen key the brute force solution I have already produced would suffice as you say because the capacitor set is relatively small as for many applications you want a capacitor in the range of nF to uF then it's a task of finding which closest preferred resistor gives the closest values to the calculated I could edit my question to include my current method at some point. However including pairs and triples would be an interesting addition to my solution – Alessi 42 Dec 07 '19 at 18:31

0 Answers0