Electronics > Projects, Designs, and Technical Stuff
standard value resistor / capacitor combination tool
<< < (4/5) > >>
Kirr:
mariush, very cool! :-+

I see your example has networks like "430 + 3p120", which means I guess that 3 of 120 are connected in parralel, and then serially with 430. I guess it's not restricted to only use identical values in parallel connections? Also, can it parallel serially connected sub-networks? Curious because as I haven't yet tried it myself. :)

E.g., can you try making 474 or 478 Ohm out of up to 4 E3 values (in the range of 1 Ohm to 1 MOhm)? Curious what it will find for these cases.

OM222O, I hope you are not discouraged by the complexity of this problem!

Cheers!
mariush:
Yes,  s means in series and p means in parallel  ... so  10 | 3s100  means 10 paralleled with 3 100 resistors in series (a 300 ohm resistor)

The software isn't that "smart", it just takes a brute force approach, generating all unique combinations of 2..4 resistors and does the math to figure out if the final value is within the tolerance.
If the total number of resistors is below the maximum resistors you opted for the script splits resistors in 2 or 3, or doubles them and does the math again.
So right now  it's just  all series, all parallel,  or series+parallel combinations

to answer your question ... here's 474 ohm, 50 results  :
 
Note it's assuming 1% max error, 5% gives 221 results for the 474 ohm ...
also used --group 0 so it's sorted by error instead of smallest number of resistors first)


--- Code: ---4    473.934    0.014% 1000 | 1000 | 10000 | 100000
4      474.2    0.042% 470 + 2.2 + 1 + 1
3      474.4    0.084% 470 + 2.2 + 2.2
4     474.55    0.116% 470 + 2.2 + 2p4.7
4     473.35    0.137% 470 + 1 + 2p4.7
4    473.333    0.141% 470 + 3p10
2      474.7    0.148% 470 + 4.7
4      473.3    0.148% 470 + 2.2 + 2p2.2
3      473.2    0.169% 470 + 2.2 + 1
3        475    0.211% 470 + 2p10
4        473    0.211% 470 + 1 + 1 + 1
4    475.162    0.245% 1000 | 1000 | 10000 | 220000
4      475.2    0.253% 470 + 4.7 + 2p1
4      472.7    0.274% 470 + 2.2 + 2p1
4      475.4    0.295% 470 + 2.2 + 2.2 + 1
3     472.35    0.348% 470 + 2p4.7
3      475.7    0.359% 470 + 4.7 + 1
4    475.709    0.361% 1000 | 1000 | 10000 | 470000
2      472.2    0.380% 470 + 2.2
4      475.8    0.380% 470 + 4.7 + 2p2.2
4      472.1    0.401% 470 + 1 + 2p2.2
4    475.964    0.414% 1000 | 1000 | 10000 | 1000000
4        476    0.422% 470 + 1 + 2p10
3        472    0.422% 470 + 1 + 1
4        472    0.422% 220 + 220 + 22 + 10
3     476.19    0.462% 1000 | 1000 | 10000
4    471.567    0.513% 470 + 3p4.7
4      471.5    0.527% 470 + 1 + 2p1
4    471.414    0.546% 1000 | 1000 | 10000 | 47000
4      476.6    0.549% 470 + 2.2 + 2.2 + 2.2
4      476.7    0.570% 470 + 4.7 + 1 + 1
4    471.285    0.573% 1000 | 2200 | 2200 | 4700
3      471.1    0.612% 470 + 2p2.2
3      476.9    0.612% 470 + 4.7 + 2.2
2        471    0.633% 470 + 1
4        477    0.633% 220 + 22 + 2p470
4     477.05    0.643% 470 + 4.7 + 2p4.7
4      477.2    0.675% 470 + 2.2 + 2p10
4    470.733    0.689% 470 + 3p2.2
4    477.333    0.703% 470 + 3p22
3      470.5    0.738% 470 + 2p1
4    470.333    0.774% 470 + 3p1
4      477.9    0.823% 470 + 4.7 + 2.2 + 1
4        470    0.844% 2p470 + 2p470
2    469.779    0.891% 470 | 1000000
4    478.261    0.899% 1000 | 1000 | 22000 | 22000
3    469.559    0.937% 470 | 1000000 | 1000000
2     469.53    0.943% 470 | 470000
4    469.338    0.984% 470 | 1000000 | 1000000 | 1000000
3     469.31    0.989% 470 | 470000 | 1000000

--- End code ---

Here's 478 ... 41 results.

--- Code: ---4      477.9    0.021% 470 + 4.7 + 2.2 + 1
4    478.261    0.055% 1000 | 1000 | 22000 | 22000
4    477.333    0.140% 470 + 3p22
4      477.2    0.167% 470 + 2.2 + 2p10
4     477.05    0.199% 470 + 4.7 + 2p4.7
4        477    0.209% 220 + 22 + 2p470
4      479.1    0.230% 470 + 4.7 + 2.2 + 2.2
3      476.9    0.230% 470 + 4.7 + 2.2
4      476.7    0.272% 470 + 4.7 + 1 + 1
3      479.4    0.293% 470 + 4.7 + 4.7
4      476.6    0.293% 470 + 2.2 + 2.2 + 2.2
4      479.7    0.356% 470 + 4.7 + 2p10
3     476.19    0.379% 1000 | 1000 | 10000
2        480    0.418% 470 + 10
4        476    0.418% 470 + 1 + 2p10
4    475.964    0.426% 1000 | 1000 | 10000 | 1000000
4      475.8    0.460% 470 + 4.7 + 2p2.2
4    475.709    0.479% 1000 | 1000 | 10000 | 470000
3      475.7    0.481% 470 + 4.7 + 1
4      480.4    0.502% 470 + 4.7 + 4.7 + 1
4      480.5    0.523% 470 + 10 + 2p1
4      475.4    0.544% 470 + 2.2 + 2.2 + 1
4      475.2    0.586% 470 + 4.7 + 2p1
4    475.162    0.594% 1000 | 1000 | 10000 | 220000
3        481    0.628% 470 + 2p22
3        475    0.628% 470 + 2p10
3        481    0.628% 470 + 10 + 1
4      481.1    0.649% 470 + 10 + 2p2.2
2      474.7    0.690% 470 + 4.7
4     474.55    0.722% 470 + 2.2 + 2p4.7
4      481.6    0.753% 470 + 4.7 + 4.7 + 2.2
3      474.4    0.753% 470 + 2.2 + 2.2
4      474.2    0.795% 470 + 2.2 + 1 + 1
4        482    0.837% 470 + 1 + 2p22
4        482    0.837% 470 + 10 + 1 + 1
4    473.934    0.851% 1000 | 1000 | 10000 | 100000
3      482.2    0.879% 470 + 10 + 2.2
4     482.35    0.910% 470 + 10 + 2p4.7
4     473.35    0.973% 470 + 1 + 2p4.7
4    473.333    0.976% 470 + 3p10
4      473.3    0.983% 470 + 2.2 + 2p2.2

--- End code ---
OM222O:

--- Quote from: Kirr on November 02, 2019, 04:21:48 am ---mariush, very cool! :-+

I see your example has networks like "430 + 3p120", which means I guess that 3 of 120 are connected in parralel, and then serially with 430. I guess it's not restricted to only use identical values in parallel connections? Also, can it parallel serially connected sub-networks? Curious because as I haven't yet tried it myself. :)

E.g., can you try making 474 or 478 Ohm out of up to 4 E3 values (in the range of 1 Ohm to 1 MOhm)? Curious what it will find for these cases.

OM222O, I hope you are not discouraged by the complexity of this problem!

Cheers!

--- End quote ---

Unfortunately I have a few university assignments taking all of my time, so I can't work on the tool right now. I will come back and update it as soon as I have enough time  :-+
Kirr:

--- Quote from: mariush on November 02, 2019, 04:49:40 am ---Yes,  s means in series and p means in parallel  ... so  10 | 3s100  means 10 paralleled with 3 100 resistors in series (a 300 ohm resistor)

The software isn't that "smart", it just takes a brute force approach, generating all unique combinations of 2..4 resistors and does the math to figure out if the final value is within the tolerance.
If the total number of resistors is below the maximum resistors you opted for the script splits resistors in 2 or 3, or doubles them and does the math again.
So right now  it's just  all series, all parallel,  or series+parallel combinations
--- End quote ---

I see!

For reference, my tool's suggestion for the same question (found with maximum precision, target error = 0):
Format: "Request: Approximation = Network (Error)"
474: ~474.001 = 470k || (4.7 + (470 || 1M)) (0.000%)
478: ~478.000 = 10 + (470 || (10k + 100k)) (0.000%)

I am beginning to miss multiple answer output.


--- Quote from: OM222O on November 02, 2019, 12:05:22 pm ---Unfortunately I have a few university assignments taking all of my time, so I can't work on the tool right now. I will come back and update it as soon as I have enough time  :-+
--- End quote ---
:-+
mariush:
I've updated the code on github (see post above), used a trick to make it much faster and not have to cache stuff on disk, now it runs faster and with much less memory usage.

Yes, the version I made currently lacks the feature of going "three levels deep" as in :

474: ~474.001 = 470k || (4.7 + (470 || 1M)) (0.000%)

it can do R1 || R2,  or R1+R2, and then goes one level deeper where R1 or R2 or both are split and the operation between these two resistors is the opposite of the operation between R1 and R2
So, you get
(R1a+R1b) || R2
R1 || (R2a + R2b)
(R1a+R1b) || (R2a + R2b)

I do this (alternate parallel and sum)  because if the user says "i want up to 4 resistors", I'd get duplicate results otherwise ex.
Solution 1: 2 resistor groups: (R1a+R1b) + (R2a+R2b)
Solution 2: 4 resistors R1a + R1b + R2a + R2b

I can certainly add a third level, provided the maximum number of resistors allows going deeper.

ex  if you say up to 4 resistors, and a solution is 0.5% close to desired value and looks like this  R1 || ( 2sR2), the code could further split the 2 R2 in series  to  R2 + ( R3||R4) and I arrive to your result.

I was reluctant to add this because when using E96 or E192 ranges it takes a long time even with just 4 resistors (20s or so to go through the 20 million or whatever unique combinations of 4 resistors, using only 128 closest resistors to desired value)
It would work ok with a reduced set, like E24 and restricting to let's say 1 ohm min,  100k max
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod