dV on stages which have no engines measured improperly
ichaleynbin opened this issue ยท 2 comments
So after discovering asparagus style craft, I've tended towards building craft which have more stages, some with stages that only contain fuel, to maximize dV for the weight. The problem is that the dV calculator is quite inaccurate when measuring the dV for craft like this. The best example I have is of a craft which has fuel tanks stuck on the side and fuel pipelines running the fuel into the main body, where the fuel tanks are jettisoned as soon as they empty. Mechjeb knows when they are empty and stages properly once they are empty, so I'm actually fairly sure that this problem isn't with the mechjeb code, as there is another piece of information which leads me to believe the mechjeb code relies a little too heavily on squad's code, which does not "understand" the staging sequence of craft, especially asparagus or "fuel tank only" staging properly.
I used the "stage only" button on the "Resources" tab, while I still had one of my fuel tank stages attached, and there was no change to the fuel available. As far as I can tell, engines are a necessity for Squad's code to recognize a difference in stage as far as available fuel. Even though I staged the fuel tanks off the side, the game considers the fuel tank drop stages as the same stage, such that both the first and the second stage of fuel tank drop are measured with the final stage, in the first stage where the engines are activated, for fuel available. This results in fairly inaccurate dV readings (I gained approximately 300 dV according to mechjeb during the last staging, from 2,600 to 2,900 dV available just by staging and dropping the fuel tanks) but I don't think that the problem is in the mechjeb code, if you don't think of depending on squad's "stage only resources" as being mechjeb code.
Yes, all of the fuel is available to the engines starting in the stage where the engines are activated, so it's understandable that it would be measured that way. This particular configuration of staging off only fuel tanks and never activating new engines, while it is more efficient, is somewhat counterintuitive, and technically all of that fuel is available to the engines which were staged. However, it makes more sense to measure only the fuel which will be used during that stage for craft such as this. I'm not sure whether it would be right for Squad to change their code to accurately reflect fuel tank only stages or not, but as far as a dV calculator, it is definitely correct to measure the fuel used during that stage. Not doing it this way reports a craft with over 5,400 dV as having less than 4,800 dV. Obviously it can be worked around but "assume the craft has ~10% more dV than mechjeb says" is a bad workaround and I'm using mechjeb because I don't want to calculate dV by hand.
Suggestions: I don't know well enough how the code looks to suggest to Squad how to fix this. I may end up giving this data to them as well, if I can figure out how, but you all know the code and what's going on better than I do by a long shot, so you'd be better suited to telling them what's up and how to fix it than I am. Plus I really don't feel like digging into the code that deep to find it, since I've never seen the code base before, theirs or yours. Nor am I certain Squad even needs to know about this, since technically all of the fuel is available during that stage.
Alternatively, you can include your own staging comprehension rather than depending on Squad's which is obviously not working properly for some types of craft. The problem is that all of the fuel available in both the craft proper and both of the fuel tank drop stages is showing as available during the first stage, when only the first set of fuel tanks are being drained. I can see why it happened that way, trying to get a computer to comprehend what I'm doing seems somewhat difficult, but given the fuel tanks will be staged off, and that's the only fuel which will be used during that particular stage, it would make more sense (and allow proper dV calculations) to measure only the fuel which will be used before the next stage, rather than all of the fuel available to the engine which has been activated in that stage. I know you have code which can detect this, as the autostager properly stages the fuel tanks off when they are emptied, but using Squad's "resources available in stage only" seems to be the problem regarding this.
I am sorry to tell you that after you wrote such a long and well written bug but did you try the MJ dev builds ? Those problems are fixed in there
http://jenkins.mumech.com/job/MechJeb2/