Jump to content

kRPC Question


Bosun

Recommended Posts

Hi everybody!

I've been playing with kRPC, and loving the fun of learning how to Python (which is how I justify playing more Kerbal) and have a question that's stumped me the last few days. 

I have a craft with a central LFO engine, surrounded by decoupler attached LFO booster stacks.  I'm looking for a way to determine when the fuel tanks that are radially attached are empty.  

Currently, I can call resources in a specific stage, which includes the main engine, and I can call object instances of all engines.  Neither of those, however, help me, because the total resource level will never equal zero before I need to jettison tanks, and I cannot seem to pinpoint a singular engine instance to test for whether the engine has_fuel.  I can test if all the engines have fuel, returning true if any single one still does, which also doesn't get me a usable result. 

Finally, I've tried to mathematically calculate the usage of propellant based on the stats of the engines, but the central and radial engines are different rates, and I also have vernor engines that differ in consumption, so my attempt to compute a hard time limit on the burn without, of course, first just running the rocket on the stand (which kinda defeats the purpose I'm looking for) failed.

Any help is appreciated!  Thanks all for any insight, this has been a really good challenge, but I'm breaking down and asking for help. 
Cheers!

Link to comment
Share on other sites

  • 2 weeks later...

Firstly, you'd get a faster response just posting in the KRPC thread.  It's where those of us that fiddle with it look more often!   Secondly -  there are several ways to do it.   Perhaps the easiest is to check the decouple stage!  

https://krpc.github.io/krpc/python/api/space-center/parts.html#staging   

All parts have two stage numbers... the stage they activate in and the stage they decouple in!  If you have those radially attached tanks decoupling at some point in the tree...  you can use that to differentiate them.

Or you can iterate through the part tree.   Engines have a 'has fuel' property you can check -  so you could iterate through all engines with a given stage and test that.  https://krpc.github.io/krpc/python/api/space-center/parts.html#engine

Also there's apparently a collection of active engines that already knows if the engine has fuel?   This example shows how to grab it... so you might be able to save a copy of the list.. then compare it later with the current one to see if it's changed?   https://krpc.github.io/krpc/tutorials/parts.html#combined-specific-impulse

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...