magico13

[1.4] StageRecovery - Recover Funds+ from Dropped Stages - v1.8.0 (March 11, 2018)

Recommended Posts

Question. How does the mod tell if your craft has enough parachutes and how does it tell distance from KSC? I'm playing dumb in thus question, but I really do want to know. If my first stage is comprised of 3 empty giganto SRBs and has 3 parachutes and it is dropped around 10km above KSC (Total guess on 10km), will it be recovered?

Share this post


Link to post
Share on other sites

Sparing the actual math details (you can check the source code if you really want to see the complete derivation. In RecoveryItem there's a function called DetermineTerminalVelocity or in the Settings class there's DetermineVtEditor) here is a, hopefully thorough enough, explanation.

Distance from KSC is the easiest, so I'll start there. When a vessel gets unloaded in atmosphere (and thus deleted by KSP), SR takes the latitude and longitude of the vessel (according to what KSP reports, which is apparently not always correct if you look a page or so back) and does a calculation of the surface distance from the space center (the Great Circle Distance). This is the exact same thing stock KSP does for normal recovery. A consequence of this is that the height above the surface doesn't matter, so 10km straight up is the same as being landed right at a place. Note that KSP returns 98% for a KSC landing, and only 100% for launchpad/runway. SR will only return a max of 98%.

The check for enough parachutes (lets do stock first) is done by calculating the total drag of the vessel with the chutes deployed (they don't have to be deployed for this check to work) and comparing that to the total mass. It calculates the terminal velocity at sea level using that info and if its below the cutoff then it will recover. The variable recovery rate model (default) returns a percentage based on the terminal velocity. 100% below the lower cutoff, and 0% above the cutoff. Between them it's quadratic, so close to the lower cutoff return rates change slowly and close to the high cutoff they change quickly. Theres a picture of the default curve in the album on the first page.

With RealChute is does something similar, but the calculations for terminal velocity are different and are the same as the ones that RealChute uses for its editor configuration things, so you should have nearly 100% agreement between them (RC doesn't take into account changes in the mass of the parachute when you resize, so you can get slightly different values).

If you want to know if something will get recovered, you can build a "test model" in the VAB/SPH (in your case, your first stage. You can do that with subassemblies I think) and press the StageRecovery button. It will then calculate everything and will tell you if the current design will be recovered (current fuel levels and empty) and what percentage of the total will be returned. Also the terminal velocity, which is handy for checking that you have enough chutes on your lander. No guesswork required :)

RealChute is handy for that too, since you can design the chutes to be the right size to land at whatever velocity you want.

Share this post


Link to post
Share on other sites
Sparing the actual math details (you can check the source code if you really want to see the complete derivation. In RecoveryItem there's a function called DetermineTerminalVelocity or in the Settings class there's DetermineVtEditor) here is a, hopefully thorough enough, explanation.

Distance from KSC is the easiest, so I'll start there. When a vessel gets unloaded in atmosphere (and thus deleted by KSP), SR takes the latitude and longitude of the vessel (according to what KSP reports, which is apparently not always correct if you look a page or so back) and does a calculation of the surface distance from the space center (the Great Circle Distance). This is the exact same thing stock KSP does for normal recovery. A consequence of this is that the height above the surface doesn't matter, so 10km straight up is the same as being landed right at a place. Note that KSP returns 98% for a KSC landing, and only 100% for launchpad/runway. SR will only return a max of 98%.

The check for enough parachutes (lets do stock first) is done by calculating the total drag of the vessel with the chutes deployed (they don't have to be deployed for this check to work) and comparing that to the total mass. It calculates the terminal velocity at sea level using that info and if its below the cutoff then it will recover. The variable recovery rate model (default) returns a percentage based on the terminal velocity. 100% below the lower cutoff, and 0% above the cutoff. Between them it's quadratic, so close to the lower cutoff return rates change slowly and close to the high cutoff they change quickly. Theres a picture of the default curve in the album on the first page.

With RealChute is does something similar, but the calculations for terminal velocity are different and are the same as the ones that RealChute uses for its editor configuration things, so you should have nearly 100% agreement between them (RC doesn't take into account changes in the mass of the parachute when you resize, so you can get slightly different values).

If you want to know if something will get recovered, you can build a "test model" in the VAB/SPH (in your case, your first stage. You can do that with subassemblies I think) and press the StageRecovery button. It will then calculate everything and will tell you if the current design will be recovered (current fuel levels and empty) and what percentage of the total will be returned. Also the terminal velocity, which is handy for checking that you have enough chutes on your lander. No guesswork required :)

RealChute is handy for that too, since you can design the chutes to be the right size to land at whatever velocity you want.

Thorough explanation! Have some rep! I'm installing now. - I almost suggest you make a small icon that displays if your craft passes or fails the parachute check. Your decision though and again, I have no clue if that would be easy to include. Thank you very much!

Share this post


Link to post
Share on other sites
Thorough explanation! Have some rep! I'm installing now. - I almost suggest you make a small icon that displays if your craft passes or fails the parachute check. Your decision though and again, I have no clue if that would be easy to include. Thank you very much!

Like, display that all the time? The main issue is that you generally are checking only for stages (like some side boosters) and not for the whole vessel. I'd like to do a break down by stages eventually, so you can click the button and see right away which stages will make it and which ones won't, but the amount of work required for that is more than I can commit at the moment.

Share this post


Link to post
Share on other sites
Like, display that all the time? The main issue is that you generally are checking only for stages (like some side boosters) and not for the whole vessel. I'd like to do a break down by stages eventually, so you can click the button and see right away which stages will make it and which ones won't, but the amount of work required for that is more than I can commit at the moment.

Yeah I was thinking that and if it is hard as you say so, don't bother in the near future :P. Best of luck ;).

Share this post


Link to post
Share on other sites
Sparing the actual math details (you can check the source code if you really want to see the complete derivation. In RecoveryItem there's a function called DetermineTerminalVelocity or in the Settings class there's DetermineVtEditor) here is a, hopefully thorough enough, explanation.

snip~

I was about to ask about a simple tutorial on rocket building with StageRecovery.

For the example let's say there's a 3 stage rocket in VAB - 2 ascent stages + orbiting craft with the root part - a Mk1 pod.

The rocket has parachutes installed on all 3 stages.

1. What happens when I press the SR button?

It shows the whole rocket recovery success/failure data

or

It shows the first stage only.

2. How to go on about building an entirely new rocket?

What I assume I should do is build from the bottom up, so basically I plop a Mk1 pod and directly underneath it I build the first stage of the rocket, install RealChutes on that stage, calculate for desired landing speed.

Then put aside the first stage, and build the second stage under the pod.

And in the end I assemble the whole rocket?

Share this post


Link to post
Share on other sites
Is this compatible with NEAR/FAR?

The calculations for terminal velocity won't be correct without parachutes (this will underestimate in most circumstances), but with parachutes the difference is negligible. In short, yes it's compatible. From a gameplay perspective everything will work fine and nothing will seem out of place or wrong.

I was about to ask about a simple tutorial on rocket building with StageRecovery.

For the example let's say there's a 3 stage rocket in VAB - 2 ascent stages + orbiting craft with the root part - a Mk1 pod.

The rocket has parachutes installed on all 3 stages.

1. What happens when I press the SR button?

It shows the whole rocket recovery success/failure data

or

It shows the first stage only.

2. How to go on about building an entirely new rocket?

What I assume I should do is build from the bottom up, so basically I plop a Mk1 pod and directly underneath it I build the first stage of the rocket, install RealChutes on that stage, calculate for desired landing speed.

Then put aside the first stage, and build the second stage under the pod.

And in the end I assemble the whole rocket?

If I get some time later maybe I'll make a short video about rocket construction with SR. I'll try to explain things as easily as possible through words for the time being.

Addressing the questions first, 1) Pressing the SR button will take the entire mass of the rocket and ALL of the parachutes and see if that could land. Generally that's not what you want for recovering stages though. It's not a simple task to be able to split stages programmatically so at the current time SR doesn't even try.

2) Generally bottom up is a good idea for totally new craft, or make stages by themselves and save them as subassemblies (or just remember the configuration: if an SRB with two radial chutes is enough for a safe landing, just add two chutes onto each SRB you use). With RealChute it isn't as big of a deal, just determine the dry mass of the stage in question (the new engineer is good for that) and enter the mass manually into the chute configuration tool (I usually add a little bit extra and aim for 5m/s touchdown, just to be safe). You can even save RC presets if you use similar configurations a lot.

You can use parts other than command pods as the initial part, so to see if a radial SRB will be recovered just make a new craft with the SRB as the root part and add parachutes as necessary. Then either save that as a subassembly, save the RealChute config as a preset, or remember what was needed for it to work. Center stack stages can use a stack decoupler as a root part, or a probe body, or a fuel tank. Using the decoupler will let you save it as a subassembly.

Powered landings usually require a bit of testing to be sure, but a totally empty rocket will have a terminal velocity of 100 m/s (without chutes). Therefore you'll need at least 250 m/s of delta-v in the stage (with atmospheric ISP). If there's still fuel in the tank then that increases the terminal velocity, so it's safer to leave 300-400 m/s of dV in the tanks for a safe landing (terminal velocities of 120-160 m/s). If you add parachutes (even if its not enough for a safe landing) then you drop the amount of fuel required by a LOT (the terminal velocity can drop to closer to 20 m/s for instance, which drops the dV requirement to 50 m/s). Even with parachutes SR requires the rocket to have a thrust-to-weight ratio of greater than one.

If you develop a launcher that works for you, you can just save the whole thing as a subassembly and use it in the future without worrying about it landing safely.

Edited by magico13

Share this post


Link to post
Share on other sites

I have an idea for the next update... maybe have a cost for recovering parts. For example: I stage a booster and it falls safely into the ocean. It should COST me money to go an retrieve it, and the further away the booster is from the KSC, the more money it will cost to retrieve it. That way we as a space agency weigh whether retrieving a separated part is even worth it.

Share this post


Link to post
Share on other sites
I have an idea for the next update... maybe have a cost for recovering parts. For example: I stage a booster and it falls safely into the ocean. It should COST me money to go an retrieve it, and the further away the booster is from the KSC, the more money it will cost to retrieve it. That way we as a space agency weigh whether retrieving a separated part is even worth it.

In a way that's what having a decreased value is. You get X number of credits back for recovering a part, but the further away it is from KSC the more it costs you to recover it, thus receiving lower number of funds in the end.

Although if you're playing with an inventory system (Construction time, or the next one magico is doing) then maybe it does make sense to have a recovery cost, since you're not actually getting money back for an item, you're just getting the item back.

Share this post


Link to post
Share on other sites

Although if you're playing with an inventory system (Construction time, or the next one magico is doing) then maybe it does make sense to have a recovery cost, since you're not actually getting money back for an item, you're just getting the item back.

When we finally get the ScrapYard up and running there actually will be a recovery cost (since you won't get refunded for parts on recovery, even manually) which SR will support. Basically you pay the difference between the part value and what you'd normally get back for recovery (so 0-2% at KSC and 90% on the other side of Kerbin).

Otherwise, the decreased recovery value as a function of distance covers what TeeGee is suggesting, and I agree that you shouldn't ever be penalized for recovering a part (which also wouldn't fit with Stock at all, since manually recovering parts on the other side of Kerbin still earns you funds).

Share this post


Link to post
Share on other sites
When we finally get the ScrapYard up and running there actually will be a recovery cost (since you won't get refunded for parts on recovery, even manually) which SR will support. Basically you pay the difference between the part value and what you'd normally get back for recovery (so 0-2% at KSC and 90% on the other side of Kerbin).

Will there be a way to delay recovering stages? Generally I have the funds rewards for things cranked way down, which means I wouldn't want to "waste" money on recovering a part until I actually need it. Or I may not even have the money to recover a stage if it's part of the launch of a mun exploration mission. I may have to wait until my Mun explorer returns to have money to do anything more.

Share this post


Link to post
Share on other sites
Will there be a way to delay recovering stages?

We haven't thought about that too much yet, but you bring up a good point. For SR I'll have to add an option to require manually deciding to recover a stage, meaning I'll need to make the recovery list persist (in some form at least. I'll likely just store the name, vessel id, and cost to recover/refund. Probably the parts list would be good too, so you can decide if you want it. Kerbals/science would be recovered always and for free though). For normally landed craft you obviously can just choose not to press the stock recover button (I like the weird side effect that Kerbals are free to recover but the ship sitting right next to them would cost substantial funds to recover, despite the fact that you still have to send out a rescue craft either way).

You'll be able to sell parts, so in the end it pretty much balances out with Stock (selling will likely be at a slightly reduced rate) but you're right that the loss of funds could be prohibitive for a time during longer/larger missions. Good thinking!

Share this post


Link to post
Share on other sites
(I like the weird side effect that Kerbals are free to recover but the ship sitting right next to them would cost substantial funds to recover, despite the fact that you still have to send out a rescue craft either way).

That's actually not that crazy from a realism perspective. A kerbal (or human) weighs an awful lot less than a command pod. Any old helicopter can fly out and pick up a kerbal or three and the few pounds of surface samples they have, but it takes a major operation to recover a 3 ton command pod.

Sure you could send out one craft to do both, but if the goal is just "hey get out there and pick up Bill" there's no reason to send the behemoth lifter and all it's winches and crew out to the site, just send the cheap little copter and pick them up :)

Share this post


Link to post
Share on other sites

Quick question: Has anyone been getting crashed flags messages with SR ?

2/3 of the flags i have planted on Kerbin have been declared "crashed" with Vt values... 3rd one is on the VAB

Share this post


Link to post
Share on other sites
Quick question: Has anyone been getting crashed flags messages with SR ?

2/3 of the flags i have planted on Kerbin have been declared "crashed" with Vt values... 3rd one is on the VAB

That's pretty weird but I have some ideas of how that could happen. Not sure what I could do except to add it to the ignore list. You can do that yourself by opening up the SR settings in the spacecenter (by clicking the SR button in whichever toolbar you're using), opening the ignore list, and adding the word "flag". I'm pretty sure that will stop those messages from erroneously appearing (can't check myself right now).

Share this post


Link to post
Share on other sites

Can someone give a short tutorial, on how to use this?

I installed the mod, and everything is looking fine (I can see the pop up dial with options in KSP). Also, when in editor, if I click the icon, I get one message with predictions. However, if I add extra stages, with chutes, i dont get extra messages. And dont get recovery messages in the end...

P.S. Just got a message with some recoveries, but dont know why this time... Could it be its because I didnt see them land?

Share this post


Link to post
Share on other sites

I'll do my best to provide a short use tutorial, or at the very least address the concerns you've raised.

After installation you should have a new button on the toolbar (for Blizzy's toolbar you'll have to add it). In the spacecenter, it goes into the settings menu. In the editor, it looks at the ENTIRE ship and compares the parachutes to the full and empty masses. It's hard to split the ship into stages as a computer even though its easy as a person. The best way to use it is to build stages individually in the editor just to make sure that they'll be recovered, then (either as a subassembly or rebuilding them manually) attach them to your main craft later.

As for the main functioning: flight mode. When a stage gets about 2.5 km away from the main ship it gets destroyed by KSP as long as its below about 22km altitude. StageRecovery then checks the parachutes and the mass, and if they're proportioned correctly (enough to get below a set speed, the Vt [terminal velocity]) it gets recovered as if it were landed right where it is. If the stage actually lands then KSP won't delete it and it won't get recovered by this (you just have to recover it manually in the tracking station).

Whenever a stage gets deleted by KSP you should get a message, successful recovery or not (which is configurable).

Some additional, more advanced stuff:

Kerbals and science also get recovered by default.

There's a GUI in the flight scene that has a more detailed, more informative set of information about recovered and destroyed stages.

Powered Recovery: If you've got a controlled stage and enough fuel/thrust you can have stages get recovered on their rockets (like the Falcon 9 by Space X) instead of (in addition to) parachutes.

There's an ignore list that you can add parts to if you're getting recovery messages you don't care about (like flags, or fairings).

There's two recovery models, one is a flat rate and one uses a variable rate that follows a quadratic curve between two speeds.

Share this post


Link to post
Share on other sites
What in the world happened here!?!? :)

Had a feeling that might happen at some point after seeing a similar post in the DebRefund thread a while back. Remind me to add that to the ignore list :P

Hey quick question Magico... How does this jive with the "transponders" strategy in admin?

Theoretically you should get the proper funds back, but I haven't really played with 0.25 so I have no idea. If it's a straight up modifier on the funds recovered then SR is setup to use the correct Transaction Reason for strategies to work properly. If there's some other voodoo magic going on then I couldn't figure it out. SR will definitely report a different value than the amount you get though, since SR reports the cost of the parts before those modifications (and I couldn't find a way to actually access what those percentages should be). You'd have to monitor the actually change in funds. Maybe I'll take a look at that this weekend and do some tests to see if it works like I hope.

Share this post


Link to post
Share on other sites

Thanks for the explanation.

I didnt know about that 2.5km limit.

Good mod!

Was there any talk that this would be included in stock KSP? (Or something similar?)

I'll do my best to provide a short use tutorial, or at the very least address the concerns you've raised.

After installation you should have a new button on the toolbar (for Blizzy's toolbar you'll have to add it). In the spacecenter, it goes into the settings menu. In the editor, it looks at the ENTIRE ship and compares the parachutes to the full and empty masses. It's hard to split the ship into stages as a computer even though its easy as a person. The best way to use it is to build stages individually in the editor just to make sure that they'll be recovered, then (either as a subassembly or rebuilding them manually) attach them to your main craft later.

As for the main functioning: flight mode. When a stage gets about 2.5 km away from the main ship it gets destroyed by KSP as long as its below about 22km altitude. StageRecovery then checks the parachutes and the mass, and if they're proportioned correctly (enough to get below a set speed, the Vt [terminal velocity]) it gets recovered as if it were landed right where it is. If the stage actually lands then KSP won't delete it and it won't get recovered by this (you just have to recover it manually in the tracking station).

Whenever a stage gets deleted by KSP you should get a message, successful recovery or not (which is configurable).

Some additional, more advanced stuff:

Kerbals and science also get recovered by default.

There's a GUI in the flight scene that has a more detailed, more informative set of information about recovered and destroyed stages.

Powered Recovery: If you've got a controlled stage and enough fuel/thrust you can have stages get recovered on their rockets (like the Falcon 9 by Space X) instead of (in addition to) parachutes.

There's an ignore list that you can add parts to if you're getting recovery messages you don't care about (like flags, or fairings).

There's two recovery models, one is a flat rate and one uses a variable rate that follows a quadratic curve between two speeds.

Share this post


Link to post
Share on other sites

Was there any talk that this would be included in stock KSP? (Or something similar?)

As of right now I have not heard anything, official or otherwise. My impression is that since in real life most uncontrolled stages are left to burn up or be recovered as scrap heaps, they likely won't add this feature as stock. If they did, they'd probably want to use a system that was less generalized than this (SR makes a lot of assumptions for simplicity, but loses a lot of physics as a result). I imagine that they'd try to find ways to run physics on the parts without bogging down the rest of the game, but if they did that it wouldn't be for a while. Probably much closer to the 1.0 release, or even afterward.

Share this post


Link to post
Share on other sites

Hello, this is indeed a great mod! Combined with Kerbal Contruction Time its fantastic!

I have a doubt, though. I launched a three-stage rocket and it behave oddly:

- 1st stage had radial chutes and was decoupled on a suborbital flight. It was recovered fine;

- 3rd stage was the cargo (a mapping satellite), it also worked fine;

The 2nd stage had a probe core to allow deorbiting after deploying the satellite. I used its boosters to lower the periapsis to 20km and then returned to KSC to watch it disappear through the Tracking Station. Problem is, the stage was not recovered as I expected! I didn't even get a failure message!

How should I do this kind of recovery?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.