11-02-2016 03:52 PM - edited 11-02-2016 03:58 PM
The problem is that there are still duplicates, for example.
(60,40,30), (80,60,50,40), (90,80,10), (90,40,20), (90,80,50,20)
all give 7.20% but the wonders of floating point math will not show them as duplicates. After a little bit weeding out the true duplicates, we do have 132 unique transmission values that can be achieved, so the number in the original post is correct.
So the question is if we want all possible filter combinations (256) or only all possible unique transmission values (132).
A better instrument would have a set of filters where each combination gives an unique total. 😄
11-03-2016 01:05 PM
Hi, Altenbach (Knight of NI). Yes, you're right. I already predicted multiple combinations leading to the same output power, as can be seen in the python code in the original post via the functions "powers(l, n)" that shows all possible combinations for each output power and "bestComb(l, n)" that shows the best combinations for each output power (i.e., the combinations that uses the least number of filters).
That is what I would like to have in labview: a VI whose input would be the available filters and the output would be the "best" possible combinations for each output power in increasing order of output power.
Thank you!
11-03-2016 01:14 PM
Well, I used LabVIEW code to generate all possibilities. Easiest is to generate all combinations, then eliminate the duplicates after approrpiate rounding to a few decimal digits. Since there are often still several combinations that use the fewest number of filters, do you have any other criteria to select the "best" (e.g. based on the average grey value, smallest filter range, etc.).
11-03-2016 01:14 PM
Hi, Darin. Thank you very much for the VI image. It seems much simpler than the one I received earlier and I suryely will try it.
11-03-2016 01:20 PM
Well... if I get all possible combinations it will be great for me. It will be easy to check among the possible cominations what's the "best" for me.
Thank you.
11-03-2016 03:00 PM
Well, the problem with Darin's code is that it uses a conditional tunnel, which is not avaiable in LabVIEW 7.1. However, It generates all valid 256 combinations.
You need to conditionally build the array in a shift register.
11-03-2016 03:42 PM
Hi, Altenbach. Can you tell me how to do this? I was trying to find an alternative way for the conditional tunel, but still didn't get a solution.
11-03-2016 03:57 PM
LV will Save for Previous to remove the conditional tunnels, of course it does it in a silly way but your arrays are so small it doesn't matter.
I don't have an older version of LV on this machine but here is a LV14 snippet showing the code saved for LV8.6 which should be fine in LV7.1
11-03-2016 04:08 PM
Thank you very much, Darin! It seems to work perfectly!!
11-03-2016 05:18 PM - edited 11-03-2016 05:19 PM
You can eliminate some of the case structures in the big loop. Here's my version.
(Note that I multiply up and round to nearest integer to avoid spurios differences between combos with identical totals. Later I scale it all back.)
(It also uses two additional loops to remove duplicates and keep a random unique combo). You can keep the one with the fewest filters by looking at the existing variant attribute and keep the shorter one, for example).