Saturday, January 16, 2010

Injector grouping, the exhaustive search

As you saw in the previous post, the way we grouped injectors was very simple, we simply sorted them by flow and picked 'top 4' and 'bottom 4' and that was it.  It seemed to work well, but how do we know there isn't a better method.

Last night I realized that there are 8 injectors, so there's factorial(8)=40320 ways of organizing the injectors.  Seems like a lot, but I figured there'd be a lot of repetition within each bank as we don't care if we get [A B C D] or [D C B A] or any other related permutations.  Thus I figured this would be problem small enough that I could calculate the flow spreads for every possible permutation (exhaustive search, by the way of brute force).

Matlab of course has a function that can generate permutations of any set of numbers, so I let it generate the 40320-entry long list.  Then I split the resulting lists into bank1 and bank2, and then executed all the calculations presented in the previous post.  An additional step at the end was summing up the two AFRdifference results, in order to come up with one final number describing the 'goodness' of the combination.  Then I found which flow permutations came up with the best (lowest spread) number.  I pick one of them, and that's my 'best' injector grouping.

So how did the exhaustive search results compare to our 'sort and split down the middle' approach?  Pretty good actually!  I ran the optimization for 3 sets of injectors and 2 of the 3 permutations we came up were actually optimal, according to this script.  The third permutation was different only in placement of 2 swapped injectors, and even then the resulting difference from what we picked was minuscule. Why does the simplistic approach work so well then?  I think it happens because if you pick a group that isn't a 'bottom half ' or 'top half' of flows, then you end up with one group that's very closely matched, but the other group ends up inherently with flows that are from two ends of the spread, negating the positive effect of the extra close group. 
I have some other ideas on how to generate the final 'goodness' number.  For right now it's just a sum of the AFRdifferences, but it could be something completely different, I could go with standard deviation of the flows within the bank multiplied out with the range of the means between the means of two banks for example.  It's just something to play with, and now that I have an infrastructure set up for it, it should be easy.


I put the quotes around the 'best' when talking about finding optimal grouping, because there are many other permutations that generate different, but effectively identical permutations.  So once you get results, you still can rearrange the numbers within the bank, to match that particularly high or low flowing cylinder.

When I originally came up with this, I figured I'm going to have to figure out how to eliminate all the 'duplicate permutations' of numbers that are reorganized within the bank, to speed up the process.  There was no need for it.  The entire script, with setup, calculations, and display of results, took a grand total of 0.03 seconds on a 2yr old 2.4GHz CPU.  Right now this is just a Matlab script, which I know is not particularly popular with gearheads due to cost ($2000!!! unless you get the $100 student version).  I will try to figure out how to make a standalone program from this script, so you have optimal flow groupings every time you redo your injectors.

--Marcin

4 Comments:

At 10:37 PM, February 01, 2010, Anonymous Anonymous said...

http://www.scilab.org/

 
At 10:49 PM, February 01, 2010, Blogger Marcin said...

This comment has been removed by the author.

 
At 10:52 PM, February 01, 2010, Blogger Marcin said...

Yes, I know of Scilab, Freemat, and Octave, they can all do it easily, however, they're not exactly the easiest tools to use. I've had gearheads chew me out for forcing them to install Excel, so I am predicting an Epic Fail if I tried to sell them on Scilab.

 
At 6:26 PM, February 02, 2010, Anonymous Anonymous said...

I know what you mean...tell people refusing to install excel to install open office...it works fairly well.

I would be all about Matlab over Scilab...as I used to be when I was both a student and an employee at a university and was able to use it all the time...but I can't do that anymore, so I'm stuck with the free stuff now...:(

 

Post a Comment

<< Home