Author Topic: How about combining some components?  (Read 10462 times)

0 Members and 1 Guest are viewing this topic.

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
How about combining some components?
« on: March 06, 2022, 11:17:19 pm »
I've created "simulators" for all the different configurations one can have with 4 passive components. Those just take a bunch of input values, combine and compare them to a desired target value and then keeping the best combination.
At first I wanted to precalculate all possibilities and store them in an efficient data format. Target values could then be searched in this file. But after some tests, doing them on the fly is fast enough. The files would have been in the hundreds of MB for the 4 component combinations. So I'm glad not needing them (an unwanted extra dependency).
The imput values are taken from the E-series. But are ranging from decade -3 to +4 (kind of) relative to the target value. Not every decade will have the same E-serie. For example it could something be like:
Code: [Select]
E012-E024-E024-[E024]-E024-E024-E012-E001Where [E024] would be decade 0. (However a small/large result can shift the input values, Just like the target is shifted in the value range 1..10 before simulating).
What sets of E-serie values are taken can be controlled using an granularity parameter (ExtraCoarse, Coarse, Fine, ExtraFine) and the maximum E-serie (E1..E192).
The granularity is used to limit the possible combinations to: 500.000, 5.000.000, 50.000.000, 500.000.000  (ExtraCoarse, Coarse, Fine, ExtraFine).
The next post is a simulation with the following parameters:
Code: [Select]
[ElectronicsTasks.CombinationTarget]
Value = 1234.56789 Ω
[ElectronicsTasks.CombinationParameters]
Tolerance = 0.000001%
MaxESerie = E24
Granularity= ExtraFine
« Last Edit: March 08, 2022, 01:33:19 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components? - Results
« Reply #1 on: March 06, 2022, 11:19:19 pm »

Electronic workbench
  Time                                    : 6-3-2022 23:27:49
  Interpreter version                     : 6.28.865
  Script version                          : 6.20.1.0.2.42
  Filename                                : Electronics workbench.xml

Simulation values manager
Task "Simulation values manager" was successfully executed (13,5 μs)

Combination target configuration
  Target value                            : 1,234567890 kΩ ± 5 μΩ
Task "Combination target configuration" was successfully executed (61,7 μs)

Combinations configuration
  Tolerances                              : 0,000001%
  Granularity                             : ExtraFine
  MaxESerie                               : E24
Task "Combinations configuration" was successfully executed (83,9 μs)

Component configuration 1 - (A)
  Matches specs                           : NO!
  Used E-series                           : [E24]
  Relative difference                     : 2,8807%
  Result                                  : 1,200000000 kΩ ± 12 μΩ
  A                                       : 1,200000000 kΩ ± 12 μΩ
Task "Component configuration 1 - (A)" was successfully executed (175,7 μs)

Component configuration 2 - (A~B)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,116%
  Result                                  : 1,236000000 kΩ ± 12 μΩ
  A                                       : 36,0000000 Ω ± 400 nΩ
  B                                       : 1,200000000 kΩ ± 12 μΩ
Task "Component configuration 2 - (A~B)" was successfully executed (2,5634 ms)

Component configuration 3 - (A|B)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,11079%
  Result                                  : 1,233201581 kΩ ± 12 μΩ
  A                                       : 1,300000000 kΩ ± 13 μΩ
  B                                       : 24,0000000 kΩ ± 200 μΩ
Task "Component configuration 3 - (A|B)" was successfully executed (2,6918 ms)

Component configuration 4 - (A~B~C)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,0026009%
  Result                                  : 1,234600000 kΩ ± 12 μΩ
  A                                       : 1,600000000 Ω ± 16 nΩ
  B                                       : 33,0000000 Ω ± 300 nΩ
  C                                       : 1,200000000 kΩ ± 12 μΩ
Task "Component configuration 4 - (A~B~C)" was successfully executed (122,0467 ms)

Component configuration 5 - (A|B|C)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00000091%
  Result                                  : 1,234567901 kΩ ± 10 μΩ
  A                                       : 1,500000000 kΩ ± 15 μΩ
  B                                       : 7,50000000 kΩ ± 80 μΩ
  C                                       : 100,0000000 kΩ ± 1,0 mΩ
Task "Component configuration 5 - (A|B|C)" was successfully executed (132,1277 ms)

Component configuration 6 - ((A|B)~C)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00049929%
  Result                                  : 1,234561726 kΩ ± 12 μΩ
  A                                       : 1,200000000 kΩ ± 12 μΩ
  B                                       : 1,000000000 MΩ ± 10 mΩ
  C                                       : 36,0000000 Ω ± 400 nΩ
Task "Component configuration 6 - ((A|B)~C)" was successfully executed (389,6991 ms)

Component configuration 7 - ((A~B)|C)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00000091%
  Result                                  : 1,234567901 kΩ ± 11 μΩ
  A                                       : 150,0000000 Ω ± 1,5 μΩ
  B                                       : 1,100000000 kΩ ± 11 μΩ
  C                                       : 100,0000000 kΩ ± 1,0 mΩ
Task "Component configuration 7 - ((A~B)|C)" was successfully executed (393,0845 ms)

Component configuration 8 - (A~B~C~D)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00000891%
  Result                                  : 1,234568000 kΩ ± 12 μΩ
  A                                       : 68,0000000 mΩ ± 0,7 nΩ
  B                                       : 1,500000000 Ω ± 15 nΩ
  C                                       : 33,0000000 Ω ± 300 nΩ
  D                                       : 1,200000000 kΩ ± 12 μΩ
Task "Component configuration 8 - (A~B~C~D)" was successfully executed (4,5768623 s)

Component configuration 9 - (A|B|C|D)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00000091%
  Result                                  : 1,234567901 kΩ ± 10 μΩ
  A                                       : 1,500000000 kΩ ± 15 μΩ
  B                                       : 15,00000000 kΩ ± 150 μΩ
  C                                       : 15,00000000 kΩ ± 150 μΩ
  D                                       : 100,0000000 kΩ ± 1,0 mΩ
Task "Component configuration 9 - (A|B|C|D)" was successfully executed (4,897420 s)

Component configuration 10 - ((A|B)~C~D)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,0000041151%
  Result                                  : 1,234567839 kΩ ± 9 μΩ
  A                                       : 390,000000 Ω ± 4 μΩ
  B                                       : 1,600000000 kΩ ± 16 μΩ
  C                                       : 11,00000000 Ω ± 110 nΩ
  D                                       : 910,000000 Ω ± 9 μΩ
Task "Component configuration 10 - ((A|B)~C~D)" was successfully executed (28,590074 s)

Component configuration 11 - ((A~B)|C|D)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00000091%
  Result                                  : 1,234567901 kΩ ± 11 μΩ
  A                                       : 150,0000000 Ω ± 1,5 μΩ
  B                                       : 1,100000000 kΩ ± 11 μΩ
  C                                       : 110,0000000 kΩ ± 1,1 mΩ
  D                                       : 1,100000000 MΩ ± 11 mΩ
Task "Component configuration 11 - ((A~B)|C|D)" was successfully executed (28,558708 s)

Component configuration 12 - (((A~B)|C)~D)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,0000010791%
  Result                                  : 1,234567877 kΩ ± 12 μΩ
  A                                       : 4,30000000 kΩ ± 40 μΩ
  B                                       : 1,000000000 MΩ ± 10 mΩ
  C                                       : 1,200000000 kΩ ± 12 μΩ
  D                                       : 36,0000000 Ω ± 400 nΩ
Task "Component configuration 12 - (((A~B)|C)~D)" was successfully executed (57,13552 s)

Component configuration 13 - (((A|B)~C)|D)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00000086778%
  Result                                  : 1,234567879 kΩ ± 11 μΩ
  A                                       : 150,0000000 Ω ± 1,5 μΩ
  B                                       : 1,000000000 GΩ ± 10 Ω
  C                                       : 1,100000000 kΩ ± 11 μΩ
  D                                       : 100,0000000 kΩ ± 1,0 mΩ
Task "Component configuration 13 - (((A|B)~C)|D)" was successfully executed (59,13981 s)

Component configuration 14 - ((A~B~C)|D)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00000091%
  Result                                  : 1,234567901 kΩ ± 10 μΩ
  A                                       : 10,00000000 Ω ± 100 nΩ
  B                                       : 240,000000 Ω ± 2 μΩ
  C                                       : 1,000000000 kΩ ± 10 μΩ
  D                                       : 100,0000000 kΩ ± 1,0 mΩ
Task "Component configuration 14 - ((A~B~C)|D)" was successfully executed (19,562633 s)

Component configuration 15 - ((A|B|C)~D)
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,0000074071%
  Result                                  : 1,234567981 kΩ ± 10 μΩ
  A                                       : 1,100000000 kΩ ± 11 μΩ
  B                                       : 27,0000000 kΩ ± 300 μΩ
  C                                       : 470,000000 kΩ ± 5 mΩ
  D                                       : 180,0000000 Ω ± 1,8 μΩ
Task "Component configuration 15 - ((A|B|C)~D)" was successfully executed (19,611336 s)

Component configuration 16 - ((A~B)|(C~D))
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,00000091%
  Result                                  : 1,234567901 kΩ ± 11 μΩ
  A                                       : 150,0000000 Ω ± 1,5 μΩ
  B                                       : 1,100000000 kΩ ± 11 μΩ
  C                                       : 18,00000000 kΩ ± 180 μΩ
  D                                       : 82,0000000 kΩ ± 800 μΩ
Task "Component configuration 16 - ((A~B)|(C~D))" was successfully executed (14,648670 s)

Component configuration 17 - ((A|B)~(C|D))
  Matches specs                           : NO!
  Used E-series                           : E012-E024-E024-[E024]-E024-E024-E012-E001
  Relative difference                     : 0,0000027054%
  Result                                  : 1,234567857 kΩ ± 12 μΩ
  A                                       : 39,0000000 Ω ± 400 nΩ
  B                                       : 18,00000000 kΩ ± 180 μΩ
  C                                       : 1,200000000 kΩ ± 12 μΩ
  D                                       : 330,000000 kΩ ± 3 mΩ
Task "Component configuration 17 - ((A|B)~(C|D))" was successfully executed (14,608783 s)

Component configurations
Task "Component configurations" was successfully executed (3,9 μs)

Done
  Time                                    : 6-3-2022 23:32:28

“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7392
  • Country: nl
  • Current job: ATEX product design
Re: How about combining some components?
« Reply #2 on: March 06, 2022, 11:26:01 pm »
You are not going to get resistors that are this accurate. E96 is about 1% accurate, E24 is somewhere between 1-5%. The best resistors that you get are going to be 0.001%, but then you are at ~20 EUR each, and for the same money, you can just order custom resistors with any value you want.
 
The following users thanked this post: Someone

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #3 on: March 06, 2022, 11:29:11 pm »
As can be seen an 8 digit precision is doable using E24 as a max. (When using E48 values the full 1,23456789 kΩ can be matched).

There's also the possibility of taking an extra step: repeatedly calculating an optimal input value for each of the inputs. This would allow for values beyond the simulated range.
« Last Edit: March 07, 2022, 02:45:37 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7392
  • Country: nl
  • Current job: ATEX product design
Re: How about combining some components?
« Reply #4 on: March 06, 2022, 11:30:40 pm »
As can be seen an 8 digit precision is doable using E24 as a max. (When using E48 values the full 1,23456789 kΩ can be matched).

There's also the possibility of taking an extra step: calculating repeatitly calculating an optimal input value for each of the inputs. This would allow for values beyond the simulated range.
Maybe you should read what temperature coefficient and accuracy means.
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #5 on: March 06, 2022, 11:32:52 pm »
You are not going to get resistors that are this accurate. E96 is about 1% accurate, E24 is somewhere between 1-5%. The best resistors that you get are going to be 0.001%, but then you are at ~20 EUR each, and for the same money, you can just order custom resistors with any value you want.
I know, but the above example is just to show this way of determing the values is more than enough for any practical use.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21688
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: HendriXML

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #7 on: March 07, 2022, 12:47:57 am »
One user friendly feature is that when changing the target value unit in for example 1234.56789 μF, it will chose an "opposite" (par=ser, ser=par) configuration to do the calculations with.


Like:

Component configuration 1 - (A)
  Matches specs                           : NO!
  Used E-series                           : [E6]
  Relative difference                     : 21,5%
  Result                                  : 1500,0000000 μF ± 1,5 pF
  A                                       : 1500,0000000 μF ± 1,5 pF
Task "Component configuration 1 - (A)" was successfully executed (541,4 μs)

Component configuration 2 - (A~B)
  Matches specs                           : NO!
  Used E-series                           : E003-E006-E006-[E006]-E006-E006-E003-E001
  Relative difference                     : 0,45994%
  Result                                  : 1228,9156627 μF ± 1,0 pF
  A                                       : 1500,0000000 μF ± 1,5 pF
  B                                       : 6800,000000 μF ± 7 pF
Task "Component configuration 2 - (A~B)" was successfully executed (867,0 μs)

Component configuration 3 - (A|B)
  Matches specs                           : NO!
  Used E-series                           : E003-E006-E006-[E006]-E006-E006-E003-E001
  Relative difference                     : 1,1941%
  Result                                  : 1220,0000000 μF ± 1,0 pF
  A                                       : 220,0000000 μF ± 0,2 pF
  B                                       : 1000,0000000 μF ± 1,0 pF
Task "Component configuration 3 - (A|B)" was successfully executed (759,6 μs)

“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #8 on: March 07, 2022, 01:02:18 am »
In the above examples I had to contribute unrealistically low tolerances to the input values, otherwise the calculated value would not be displayed accurate enough. The reason for that is that the scripting engine calculates with propagating uncertainties. Like this example:
 

Electronic workbench
  Time                                    : 7-3-2022 01:51:10
  Interpreter version                     : 6.29.868
  Script version                          : 6.28.2.0.2.51
  Filename                                : Electronics workbench.xml

Simulation values manager
Task "Simulation values manager" was successfully executed (25,9 μs)

Combination target configuration
  Target value                            : 1234,567890 μF ± 5 pF
Task "Combination target configuration" was successfully executed (117,7 μs)

Combinations configuration
  Tolerances                              : 10%
  Granularity                             : ExtraFine
  MaxESerie                               : E6
Task "Combinations configuration" was successfully executed (196,5 μs)

Component configuration 1 - (A)
  Matches specs                           : NO!
  Used E-series                           : [E6]
  Relative difference                     : 21,5%
  Result                                  : 1500 μF ± 150 μF
  A                                       : 1500 μF ± 150 μF
Task "Component configuration 1 - (A)" was successfully executed (476,3 μs)

Component configuration 2 - (A~B)
  Matches specs                           : NO!
  Used E-series                           : E003-E006-E006-[E006]-E006-E006-E003-E001
  Relative difference                     : 0,45994%
  Result                                  : 1230 μF ± 100 μF
  A                                       : 1500 μF ± 150 μF
  B                                       : 6800 μF ± 700 μF
Task "Component configuration 2 - (A~B)" was successfully executed (871,2 μs)

Component configuration 3 - (A|B)
  Matches specs                           : NO!
  Used E-series                           : E003-E006-E006-[E006]-E006-E006-E003-E001
  Relative difference                     : 1,1941%
  Result                                  : 1220 μF ± 100 μF
  A                                       : 220 μF ± 20 μF
  B                                       : 1000 μF ± 100 μF
Task "Component configuration 3 - (A|B)" was successfully executed (785,6 μs)



The accuracy which needs to be targetted is taken from the targets significant digits, but can also specified like 100 Ω ± 1% or 100 Ω ± 10 Ω.
But whether it is a good match (Matches specs) is not only determined by the value of the calculated result, but also determined by the (propagated) uncertainty of the result. (Determined by the tolerances of the input values.)
« Last Edit: March 07, 2022, 01:16:21 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components? - Hybrid method
« Reply #9 on: March 08, 2022, 03:36:36 pm »
I wanted to know what difference it would make, if (coarse) simulated values where recalculated and matched with possibly finer ESerie values (Refine=Yes).
One reason for this is that it is faster to calculate than it is to simulate with more values. It seems to makes only a small difference. This is good news, in the sense that the input sets taken for the simulations are adequate. However the best input set has values that are "tightly bound" together, recalculating cannot fundamentally change 2 or more components. Simulating with extra values is the way to get better fundamentally different combo's. For practical use: combining 3-4 components, even of low ESeries can already result in closely matched replacement values.
Here's an nice example of 987,65432100 Ω:

Electronics workbench
  Time                                    : 8-3-2022 15:57:07
  Interpreter version                     : 6.30.869
  Script version                          : 6.30.2.0.2.51
  Filename                                : Electronics workbench.xml

Simulation values manager
Task "Simulation values manager" was successfully executed (21,7 μs)

Combination target configuration
  Target value                            : 987,65432100 Ω ± 50 nΩ
Task "Combination target configuration" was successfully executed (80,6 μs)

Combinations configuration
  Tolerances                              : 0,0000001%
  Granularity                             : ExtraCoarse
  MaxESerie                               : E24
  Refine                                  : Yes
Task "Combinations configuration" was successfully executed (91,8 μs)

Component configuration 14 - ((A~B~C)|D)
  Matches specs                           : NO!
  Used E-series                           : E3-E6-E6-[E6]-E6-E6-E3-E1
  Relative difference                     : 0,000000000015432%
  Refined                                 : Yes
  Result                                  : 987,6543210 Ω ± 1,0 μΩ
  A                                       : 82,00000000 μΩ ± 0,00008 nΩ
  B                                       : 33,00000000 kΩ ± 30 μΩ
  C                                       : 47,00000000 kΩ ± 50 μΩ
  D                                       : 1,0000000000 kΩ ± 1,0 μΩ
Task "Component configuration 14 - ((A~B~C)|D)" was successfully executed (90,4166 ms)

Done
  Time                                    : 8-3-2022 15:57:12



Electronics workbench
  Time                                    : 8-3-2022 15:57:43
  Interpreter version                     : 6.30.869
  Script version                          : 6.30.2.0.2.51
  Filename                                : Electronics workbench.xml

Simulation values manager
Task "Simulation values manager" was successfully executed (13,4 μs)

Combination target configuration
  Target value                            : 987,65432100 Ω ± 50 nΩ
Task "Combination target configuration" was successfully executed (84,1 μs)

Combinations configuration
  Tolerances                              : 0,0000001%
  Granularity                             : ExtraCoarse
  MaxESerie                               : E24
  Refine                                  : No
Task "Combinations configuration" was successfully executed (100,8 μs)

Component configuration 14 - ((A~B~C)|D)
  Matches specs                           : NO!
  Used E-series                           : E3-E6-E6-[E6]-E6-E6-E3-E1
  Relative difference                     : 0,000001542%
  Refined                                 : No
  Result                                  : 987,6543362 Ω ± 1,0 μΩ
  A                                       : 100,00000000 mΩ ± 0,10 nΩ
  B                                       : 33,00000000 kΩ ± 30 μΩ
  C                                       : 47,00000000 kΩ ± 50 μΩ
  D                                       : 1,0000000000 kΩ ± 1,0 μΩ
Task "Component configuration 14 - ((A~B~C)|D)" was successfully executed (89,2918 ms)

Done
  Time                                    : 8-3-2022 15:57:48

But 3 resistors can be good enough as well:

Electronics workbench
  Time                                    : 8-3-2022 16:34:25
  Interpreter version                     : 6.30.869
  Script version                          : 6.30.2.0.2.51
  Filename                                : Electronics workbench.xml

Simulation values manager
Task "Simulation values manager" was successfully executed (15,2 μs)

Combination target configuration
  Target value                            : 987,65432100 Ω ± 50 nΩ
Task "Combination target configuration" was successfully executed (63,2 μs)

Combinations configuration
  Tolerances                              : 0,0000001%
  Granularity                             : ExtraCoarse
  MaxESerie                               : E24
  Refine                                  : No
Task "Combinations configuration" was successfully executed (86,1 μs)

Component configuration 5 - (A|B|C)
  Matches specs                           : NO!
  Used E-series                           : E6-E24-E24-[E24]-E24-E24-E6-E1
  Relative difference                     : 0,00000000125%
  Refined                                 : No
  Result                                  : 987,6543210 Ω ± 1,0 μΩ
  A                                       : 1,0000000000 kΩ ± 1,0 μΩ
  B                                       : 120,00000000 kΩ ± 120 μΩ
  C                                       : 240,0000000 kΩ ± 200 μΩ
Task "Component configuration 5 - (A|B|C)" was successfully executed (102,8167 ms)

Done
  Time                                    : 8-3-2022 16:34:29

« Last Edit: March 08, 2022, 04:19:10 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #10 on: March 09, 2022, 12:24:49 am »
As said, when I started this addition to my workbench script I assumed precalculating every combination would be needed. But by choosing the input values efficiently on the fly simulating is doable. But would this be used for a webservice better performance by using precalculations would be mandatory. For this reason I still shift (scale up/down by orders of 10) the target. So the same input/output combos can be reused. Just scale the input values after simulating. This greately reduce the number of combinations which would have end up in a datafile. Also this does not limit the range of values it can handle (micro farads or giga ohms) when using precalculated values.
Not only for speed, but also storage wise a reduced set is key.
Accessing such a file would have been done by memory mapping. With that technology the file is accessed as memory, which is "paged in" as needed. (Like a pagefile, but unidirectional.)
Next step will be to filter out combinations which are not "on stock". Checking them also needs scaling, but with a preprocessed "mapping" this can be done very fast.
I could use the on stock values directly for simulating, but then this would be become incompatible with a precalculated file as an option.
Using a fixed set of eseries will unfortunately also rule out non eserie values, these will be discarded.
« Last Edit: March 24, 2022, 12:22:08 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
How about combining some components? Partkeepr components filter
« Reply #11 on: March 11, 2022, 11:17:46 pm »
Simulated input values can now be checked against a list of available values. These can be placed in a textbox or -more advanced- be taken from a Partkeepr database.
This will be incorporated in my BOM tool https://github.com/HendriXML/KiCad-BOM-reporter
It is possible to specify a filter of which components to use from the database. For instance only accurate power resistors.
Code: [Select]
[CombinationTarget.Input.Resistor]
ComponentKind=Resistor
PowerRating.Min = 2 W
Tolerance.Max = 2%

Also the inner loop code had a slow function call, which I removed, the simulation is now many times faster (>10x). Now even extra fine granularity runs within seconds, I will probably scale the max combinations for each granularity by 10.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #12 on: March 23, 2022, 02:14:59 pm »
I've updated my BOM repository with the simulation. The process is as follows:
  • Available values are retrieved from stock components, using user defined specifications
  • Those values are matched with E-serie values, unmatched e-serie values are excluded from simulation
  • The best combination is refined using available values
  • The best combination is matched with stock components, also reporting their location and specifications
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #13 on: March 23, 2022, 04:09:17 pm »
B.t.w. when setting UseStock=No the script can be used independently from PartKeepr. Available values can then be taken from the Input tabsheet or  from a textfile.
Off course it is also possible to use the full (unmatched) e-series.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #14 on: March 25, 2022, 12:22:22 pm »
Something is bugging me, I've recently bought some aliexpress 500 mΩ which cannot be mapped to an e-series value.

So they might only be picked after a refine step. This cannot be!  :scared:

For determing what set of e-serie value to take for a certain granularity, my code uses some precalculated values about how many variations are allowed at most.
This might be something like:
Code: [Select]
        000078 // ExtraCoarse
      , 000140 // Coarse
      , 000250 // Fine
      , 000446 // ExtraFine
That's for 4 component configuration 16 and 17. These limits depend on how many (groups of) interchangeable components there are within a configuration.

I've got 140 different resistor values on stock, so in my case they could easily be fully simulated. However I'll implement a preprocess that limits the input values by discarding values which are most different to the target value. A bit rough, but this will in practice only hurt the 4 component configurations on lower granularities.
« Last Edit: March 25, 2022, 04:07:49 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #15 on: March 26, 2022, 01:52:47 pm »
When supplying available values and setting the config option UseESeries=0, (which is now the default setting) those values will be used in the simulation.

My 141 resistors take about 100 ms, when simulating a 4 component configuration. Consider that 141^4 is still 395.254.161 combinations (without deduplication).

But as can be seen the combinations expand pretty quickly, each granularity step is about 10x more time consuming.
Code: [Select]
        000078 // ExtraCoarse
      , 000140 // Coarse
      , 000250 // Fine
      , 000446 // ExtraFine

446 resistors would take about 100x longer: 10s.

If many (> 446) of the available values where badly spread near the target value, the chosen method of selecting values could be suboptimal for 4 component configurations. But it doesn't need to be perfect.

I think the screenshot also gives an idea on how specifications are matched. Its comparable when the scripts are used as a BOM reporter.
« Last Edit: March 26, 2022, 01:56:27 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #16 on: March 27, 2022, 10:32:20 pm »
If one takes a 10,000 values (1 <= Value < 10), spread like "E10000" and simulate each of those using 17 the different configurations, one could determine which configuration is best on average/worst difference and how they relate to one another.
To do this I'll simulate these decades/values E6-E12-E12-E12-[E12]-E12-E12-E12-E6-E1. Where [E12] ranges from 1.0 until 8.2. (Because the simulation speed had improved, I added 2 decades.)

This simulation could also show what precision is guaranteed when using a certain type of configuration. This could be usefull when knowing the required accuracy, but not knowing the required value yet. In that case one still can choose a configuration on forehand.
« Last Edit: March 29, 2022, 11:53:39 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
How about combining some components?
« Reply #17 on: March 28, 2022, 10:45:51 pm »
I simulated the 10,000 target values and put the results into a xml file (as well as a 1000 values version). I let Excel calculate the average and maximum diffs for each configuration and plotted those.

It shows clearly that some configurations are better in general to get a matching replacement value then others. Also a guaranteed 0.1% precision can already be achieved by using 3 components using config 6 & 7.

Config 12 & 13 can be up to 100x more precise, but would then in practice need very low tolerance resistors. It should be mentioned that not all possible e-serie values where simulated (nor all target values), it could be that some configurations would benefit more from extra very low, or extra very high values to get near a target value.

Have these results some meaning?

To me they do, because I like to continiously (re)calulate most of schematics values while designing. If some part needs an accurate voltage, a voltage divider with one resistor and config 6 or 7 could then be chosen. The actual values could then be simulated as part of the calculations. For this I use the same tool and comparable scripts.
« Last Edit: March 29, 2022, 11:54:01 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21688
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: How about combining some components?
« Reply #18 on: March 28, 2022, 11:22:12 pm »
Obligatory:
https://xkcd.com/1319/
https://xkcd.com/1205/
:P

Afraid I don't have much to add as it's not a pressing matter to me and I have about enough tools handy to do what I need.  But watching nonetheless. :-+

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: Damianos, HendriXML

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #19 on: March 29, 2022, 12:13:24 am »
https://xkcd.com/1205/
Very true.

I once had a nice and short conversation with an app developer. He redesigned some functionality, which made things unlogical and a bit annoying (but not the reason for the conversation). He said some feature was used more often and now it could be accessed faster. My reply was that users don't count seconds, but frustrations.

In a way here also lies the power of good automation, it's not necessarily about time shaving, but also about not having to switch or divide attention, so one can keep focus on other tasks.
It might also be less error prone, which can also be stress relieving.

In my career as a developer I spend some good amount of time on tools and generating code. Best time spend!
« Last Edit: March 30, 2022, 09:00:30 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #20 on: March 30, 2022, 01:12:23 pm »
I've added some documentation in my repository:
https://github.com/HendriXML/KiCad-BOM-reporter/wiki/Determine-optimal-available-combinations-for-replacement-value

The default behavior is straight forward (with a valid inventory setup).

For standalone (no stock values, no inventory database) some extra settings are required, at the least:
Code: [Select]
[ComponentCombinations.Stock]
UseStock=No

But also a different source of available values or activating the use of e-series.

I think the functionality in the current state is quite usable, but probably mostly as a part of my personal toolset.

The generated data file could also be used on itself (with scaling target and inputs when needed), the input values used are however limited to E12.

About the calulating relative differences:
I choose not to calculate it as: Diff = |Target-Actual|/Target
But as:
Code: [Select]
if Actual > Target then
  Diff = Actual/Target - 1
else
  Diff = Target/Actual - 1
For instance if a Target of 10 has 2 actual values (combination results) 1 and 20
In the used calculation the difference is:
1: 900%
20: 100%
In the not used calculation this would be:
1: 90%
20: 100%
For most replacement values the difference between the 2 calculation methods would be smaller.
However it can matter, for instance http://kirr.homeunix.org/electronics/resistor-network-finder/?series=&bases=&from=&to=&gaps=&extra=1+20&target=10&max-size=1&target-error=0.1&use-serial=1&use-parallel=1&use-bridges=1 seems to choose 1, where my method would choose 20 as best match.

“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21688
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: How about combining some components?
« Reply #21 on: March 30, 2022, 05:12:56 pm »
Might be nice to have a switch for logarithmic comparisons.  Whereas 20 is 200% of 10, and 10 is 50% of 20, they're simply log2(20/10, 10/20) = (1, -1) factor apart.

Use whatever base you prefer, of course; for comparison purposes, it doesn't matter, as long as it's consistent.  if reporting to the user, base 10 might be preferred, perhaps even as dB.  dB isn't often used with resistance I think, but I don't see why not.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #22 on: March 30, 2022, 07:31:53 pm »
I'm not that mathematically skilled, but I think the comparisons are done in a logarithmic way. But I can't determine whether we're on the same page..
Code: [Select]
e^abs(log(actual)-log(target))
$${\%e}^{\left| \log{\left( \mathrm{actual}\right) }-\log{\left( \mathrm{target}\right) }\right| }$$

should be the same as

Code: [Select]
if Actual > Target then
  Diff = Actual/Target
else
  Diff = Target/Actual

Subtracting 1 doesn't change comparisons.

Code: [Select]
if Actual > Target then
  Diff = Actual/Target - 1
else
  Diff = Target/Actual - 1

Also raising the difference to the power of e (or whatever) doesn't change comparisons as well.

So my comparisons should be the same as finding the smallest:
$${\left| \log{\left( \mathrm{actual}\right) }-\log{\left( \mathrm{target}\right) }\right| }$$

(Please correct me if I'm wrong)

On how to display the difference: I find % a bit easier to understand, but that's because I'm not that familiar with dB's.
On the other way, reading very low % like 0,000000000015432% doesn't make much sense either.

The most usefull info is probably the "Matches specs" determination.
« Last Edit: March 30, 2022, 09:39:57 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21688
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: How about combining some components?
« Reply #23 on: March 30, 2022, 09:03:38 pm »
If you're just doing comparisons, yeah, it doesn't matter.  Log and exp are one-to-one functions, so the comparisons are ordered the same.  Taking the absolute versus percentage difference is more the point I should be making.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline HendriXMLTopic starter

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nl
    • KiCad-BOM-reporter
Re: How about combining some components?
« Reply #24 on: March 31, 2022, 07:15:52 pm »
I've been pondering about a good metric which tells how well the combination replacement value matches the target.
I report whether it matches the specifications by calculating a target range:
Target - Target Uncertainty ... Target +Target Uncertainty
And a combo result range:
Actual - Actual Uncertainty ... Actual + Actual Uncertainty
Then I determine whether the actual range is fully covered by the target range.
This shouldn't be to bad, but the best determination should I think consider a 68٪ probability. (Like the uncertainties)

Besides a true or false answer, a good metric would be nice. Maybe one that takes the uncertainties into account.

Comparing differences with
|log(a) - log(t)|
Is OK, however displaying that result could be less interesting.
One way to make it meaningful is to change the logbase (suggestion by T3sl4co1l).
It could be changed to a base where values < 1 would be in spec, and values larger out of spec.
A value of 0 would be a perfect match (but not necessarily be within spec, if actual uncertainty is to large).

For the current way of determining "within spec" I know how to get to this logbase.

But maybe someone knows the right way of within spec determination. Or has another suggestion?
« Last Edit: March 31, 2022, 07:17:38 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf