-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STAGE:LIQUIDFUEL counts inaccessible fuel. #513
Comments
Confirmed here too. Only occurs during/after staging, and only sometimes. kOS version 0.15.5, KSP 0.90 |
I haven't made the time to test this report yet but I wanted to be clarify. Is this a problem only for the few updates while you are staging? Or once On Wed, Jan 21, 2015, 01:54 surge9000 notifications@github.com wrote:
|
I dont know what you mean by 'the few updates while you are staging'. Once stage:*fuel (I've seen it for solidfuel too) becomes wrong, it stays wrong, even if you stage manually, if that's what you mean. I thought it might be a problem related to identical fuel tanks in different stages, but I checked a few hours ago with several tens of explosive and hilarious launches, but nope, i cant figure out a pattern that's helpful to you. Sorry. |
As surge9000 said, it's an ongoing problem- in my repro, the fuel reported by the script starts at 90 at the beginning of stage 2, and drops gradually to 45 at flameout, when it should be starting from 45 and dropping to 0. FWIW, this problem seems to correlate with a problem where KSP itself gets confused about the structure of the craft: when I edit the craft in the VAB, it keeps wanting to put engines and separators in the wrong stages. I manually fix this, of course, but it's possible that KOS is somehow reading whatever the VAB thinks the staging is "supposed to be", instead of what it actually is. |
I dont want to presume, but searching around for (unrelated) kOS bugs in vecdraw and geoposition happened to present this: A few of my tests showed that ALL parts have stages marked.e.g. try this on a sufficiently complicated rocket: list parts in fubar. It's just that some of them like struts and 'useless' bits are numbered higher than or equal to the launch stage. If that fix was implemented the way it seems to have been, it's wrong. |
Issue #174's fix is entirely moot now and has been entirely overridden with new code. KSP itself provided an API for how to get stage quantities, and @erendrake replaced all the work I did in #174 with calls to KSP's own API. We figured it makes more sense to use SQUAD's own API for this if they provide one, as that would be more forward-compatible with future versions. It may be that part of getting it changed to the new system introduced a new bug, but all the comments in issue #174 should be thought of as irrelevant now. |
@surge9000 the reason the stage numbers seem bizarre is that the STAGE suffix seems to be reporting the "istg" value of the part. According to this thread, that number is meaningful only for parts that appear in the staging list. For all other parts, istg is set equal to dstg, and dstg is numbered a different way (something like twice the number of decouplers between the part and the root). So the stage numbers can seem out of whack if you expect them to make sense relative to each other, but they make sense so long as you only compare parts in the staging list to other parts in the staging list, and parts not in the staging list to other parts not in the staging list. @Dunbaratu Is it possible that some sort of istg/dstg mix-up is responsible for this issue? |
@Dunbaratu do you still have the link to the thread where Harv replied to you about what method he advised we use? |
A workaround for autostaging could be something like this: until altitude > 100000 or ship:apoapsis > 200000 { |
This may be related? Do you remember if you were using the procedural fairings interstage fairing? |
I probably had procedural fairings installed, but I didn't have any fairings on the ship in question - see the .craft file. |
so since we have to ditch the KSP API and roll our own logic we have some decisions to make about different types of resources
each of these types behaves differently and should be included in stage only when appropriate. |
This is my first stab at some rules
|
I think that what most people are probably expecting when they ask for stage:liquidfuel is the number corresponding to the little green bars showing up in the side staging list, and NOT the values in the upper-right window when you click "stage values". When the green bars all go to zero, stage:liquidfuel should be zero. So I'd say do not count any fuel that isn't attached to any active engine (they don't appear as green bars in the list). |
@Dunbaratu im sure you are right for the STACK_PRIORITY_SEARCH resources. how about for monopropellant? should STAGE:MONOPROPELLANT always be the same as SHIP:MONOPROPELLANT ? |
Does monopropellant always "travel" globally or can it be blocked by a non-crossfeed part? |
I believe that all RCS thrusters draw from the entire ship, but from lower stages first; however the monopropellant engine draws from the stage to which it's attached. This complicates the issue because what the user wants would depend on what type of monopropellant thruster they're trying to pull the fuel levels for. Probably best to keep the two separate. |
@space-is-hard seriously? i honestly havent used the monoprop engines yet but if they use monoprop like other engines use fuel thats pretty messed up :P |
well, i guess not that messed up, just not what i expected. |
95% sure that's how it is. The KSP wiki doesn't specifically say, so you'll have to confirm in-game |
Even if it isn't, sometimes I'll throw extra monopropellant on a lower stage despite that stage not having any RCS thrusters. It'll draw monopropellant from that lower stage first, and leave the upper stage full upon separation. For example, my CSM has thrusters on both command and service modules, and both modules hold monopropellant, but the service module provides all monopropellant while it's attached. Once I drop the service module, I'll still have full monopropellant in the command module so I can orient properly during re-entry (I config reaction wheels down to realistic levels, hence the need for RCS on the capsule). |
To clarify, it doesn't draw from the LOWEST tank, but from the FURTHEST tank. It's only coincidental that the two are the same in your design. |
I have the same with tanks and engines from AES. Ship can be reconfigured with correct liquidfuel count, that's strange. Also, more complex control with engine:fuelflow does'nt work because fuelflow always zero. |
@dvenum are you trying to determine if you should stage because an engine ran our of fuel? if so
is what i use. edit: i dont actually know if stage:ready is in release? |
@erendrake, You are right. Thank you, It's work now. It was my first rocket with kos. edit: stage:ready there is in 0.16.2. |
Use this to access a parts resource directly.
|
Still exists in 1.0.4. Want to note here that quick start tutorial currently relies on correct STAGE:LIQUIDFUEL behaviour, that is very confusing for a beginner. The condition there might probably be changed to whether the thrust is positive. |
My quick work around answer is that you should use I'm having a hard time replicating this issue other than when the root part is in a stage with no liquid fuel. For my test, I used the vessel linked at the top of this issue, but inserted a stack decoupler between the probe core and the batteries. Launch the vessel, cut the throttle, and then stage. Under those conditions, the value returned for Through a little trial and error, I have determined that the stock function When I combine stages 2 and 3, the total capacity of the new stage 3 (previously stage 4) correctly shows 45. If this change is made in the VAB prior to launching the vessel or prior to the first "stage" event, then the correct available quantity is shown. But if this is done after the first staging event, only the value from the previous stage 2 is returned and not the value for the previous stage 4. Moving engines and decouplers into different stages only appears to move the problem around. I've spent a little time walking through the underlying code in KSP trying to see how they calculate this value, and it's complicated to say the least. There is a chance that tonight or over the next couple of days I can dig in to it a little more, but short of grabbing code from alternate resource panel or KER I don't think there is a quick answer. Last thought that came to me just before clicking comment: We can easily get a list of active engines, could we then use the propellants list to record the value for |
I have taken a few stabs at this and the issue that keeps coming up is the definition of what is interesting is in the stock resource panel if you hit the My few attempts at squaring this circle ran into me making a bunch of breaking changes to our API. which is a bummer. |
I made a change to the code on my local copy today that looks like it has it working. At the very least, it's working the same way it already does. That is to say, it will return the total amount of the resource available for all engines. This won't work for asparagus staging, since there is still fuel available for an active engine at that point. I recommend using this new implementation anyways due to the following:
I think the goal should not be to be perfect for all situations, but rather predictable and reliable for as many situations as possible. If we can eliminate the obvious stage mis-match, that should work well. Any one else have any thoughts? |
Fixes KSP-KOS#513 StageValue.cs * Re-write the resource getter code to return liquid fuel and oxidizer (and any other STACK_PRIORITY_SEARCH resource) based on the active engines. * This will return the total amount available to all currently active engines. It will not return zero when an asparagus stage is depleted. It will also count any fuel available to an engine that was manually activated rather than staged. * All other resources are returned according to what the root part is able to access (in my testing this aligns with the value shown in the resource panel). Fix stage:liquidfuel Fixes KSP-KOS#513 StageValue.cs * Re-write the resource getter code to return liquid fuel and oxidizer (and any other STACK_PRIORITY_SEARCH resource) based on the active engines. * This will return the total amount available to all currently active engines. It will not return zero when an asparagus stage is depleted. It will also count any fuel available to an engine that was manually activated rather than staged. * All other resources are returned according to what the root part is able to access (in my testing this aligns with the value shown in the resource panel).
I'm experiencing an issue where, when I run this script on this .craft file,
STAGE:LIQUIDFUEL
seems to include fuel from the next stage up, even though the current engine can't use it. Specifically, when stage 2 activates, the script reports that it has 90 liquidfuel, when in fact it only has 45. Consequently, when the stage 2 engine flames out, kOS still thinks it has 45 liquidfuel, so it doesn't activate the next stage.The text was updated successfully, but these errors were encountered: