Jump to content

[WEB] [1.0.5] KSP Optimal Rocket Calculator v1.20


Recommended Posts

KSP Optimal Rocket Calculator v1.20

for Kerbal Space Program 1.0.5

http://garycourt.github.io/korc/

The KSP Optimal Rocket Calculator (KORC) is a web app that allows you to quickly find the most mass or cost efficient rocket, for a given payload, with the parts you have unlocked or installed.

Here's how to use it:

Open http://garycourt.github.io/korc/ in a modern web browser.

  1. Enter the mass (in metric tons) of the payload you are trying to move.
  2. Enter the minimum amount of Delta-V you need to accelerate it.
  3. If you are launching your payload from a planet, select the planet, or enter the force of gravity at your launch point.
  4. Select which parts you have unlocked, or mods you have installed.
  5. Hit search and watch the result come in!

If your rocket has more then one stage, you will see a list of possible designs at the bottom of the page, ordered by most to least efficient.

The program will constantly keep generating new designs, and displays only the top 20 most efficient ones. You can hit stop at any time if you see one you like.

Now that you've figured it out, there are many more other constraints you can configure:

  • What metric you would like to optimize your rocket for.
  • The minimum (and optionally, maximum) thrust-to-weight ratio you need all stages of the rocket to produce. Remember that this must be greater then 1 to leave the surface of your selected planet. This field has no affect if there is no gravity.
  • The maximum number of stages you want your rocket to have. Keep this number low as it increases the calculation times exponentially.
  • If you would like your rocket to use asparagus staging (all engines fire at once, fuel is taken from outer stages first). This always produces lighter rockets and the cost of greater complexity.
  • Have all calculations use the engine's atmospheric stats. This is not normally needed as most delta-V cheat sheets use vacuum stats.
  • And many more!

Be aware that this program runs locally in your web browser, and will max out your CPU while running. Don't forget to click "Stop" before switching back to Kerbal Space Program!

If you are getting wildly different numbers in Kerbal Engineer, it's likely that you've enabled Atmospheric Stats in one tool and not the other. Or else you've messed up your staging. But if you do happen to find any bugs, let me know.

Changelog


Version 1.20 - November 9, 2015
* Updated parts for 1.0.5

Version 1.19 - May 5, 2015
* Re-enabled atmospheric engine stats.

Version 1.18 - April 29, 2015
* Updated parts for KSP 1.0. Removed part packs that haven't been updated.
* Fixed bug in gimbal check.
* Disabled atmospheric engine stats.

Version 1.17 - December 20, 2014
* Updated parts for KSP 0.90.

Version 1.16 - November 16, 2014
* Added option to force last stage to have a thrust adjustable engine.
* Updated parts to include throttle data.

Version 1.15 - October 14, 2014
* Updated parts for KSP 0.25.
* Non-round parts are not selected by default.

Version 1.14 - August 10, 2014
* Added option to force each stage to have a gimbaling (thrust vectoring) engine.

Version 1.13 - August 9, 2014
* Created part_parser for parsing part files and generating part lists for kspcalc.js.
* Updated all parts to their latest version using part_parser.

Version 1.12 - August 5, 2014
* Updated parts for KSP 0.24.2 (by pee8379).

Version 1.11.1 - May 27, 2014
* Performance improvement (by Apexo).

Version 1.11 - April 1, 2014
* Updated and added new parts from KSP 0.23.5.
* Disabled LFB KR-1x2 until code can support liquid boosters.

Version 1.10 - February 13, 2014
* Added option to allow equal tank sizes to be bigger then the engines.
* Fixed Delta-V unit typo.
* Fixed single stacks from being created under an Aerospike Rocket (as KSP 0.23 doesn't allow this).
* Fixed bug where single stack rockets would have clustered engines.

Version 1.9 - February 5, 2014
* Added KW Rocketry 2.5.6 pack.
* Fixed bug "Last stage must be a single stack" not working
* Fixed bug with stack decouplers being the wrong size when radial tanks are used

Version 1.8 - February 5, 2014
* Performance improvements.
* Now displays payload fraction.
* Changed max symmetry to maximum number of stacks.
* Stack multiplier is now easier to read.
* Changed default settings.

Version 1.7 - January 30, 2014
* Added engine clustering to search.
* Added branch parts from Stock.
* Added min/max burn time restriction.
* Added maximum mass restriction.
* Added maximum part count restriction.
* Added KSPX 0.2.5 pack.
* Now outputs just the parts in a stack, with a separate multiplier on how many stacks are required.
* Fixed bug with decoupler size matching.

Version 1.6 - January 13, 2014
* Added time to finish stage to results.

Version 1.5 - January 8, 2014
* Added Part Count optimization, with a secondary optimization criteria.
* Added field for changing the maximum amount of symmetry allowed per stack.
* Added option for forcing the last stage to be a single stack.
* Added option for forcing all tanks & stack decouplers in a stage to be the same size.
* Added option for forcing all tanks & stack decouplers in a stage to be the same size as the engines (except radial engines).
* Added additional summary fields to the header of search results.
* Small visual change to search results.
* Added part sizes to Stock parts data.
* Fixed symmetry issues with multiple stages of radial parts. Makes rockets much easier to build.

Version 1.4 - January 7, 2014
* Added max thrust-to-weight ratio field.
* Added separate valid/invalid design count.
* Added preliminary part count code.
* Added link to asparagus definition.
* Fixed Fuel Ducts to have no mass.

Version 1.3 - January 6, 2014
* Fixed Isp conversion factor.
* Stages are now allowed to have no LF/O engines in an asparagus setup.

Version 1.2 - January 6, 2014
* Added asparagus indicator to staging output.
* Performance improvement.
* Added link to changelog.

Version 1.1 - January 6, 2014
* Added option for adding a decoupler between the payload.
* Changed masses to use metric tons.
* Changed internal thrust values to use kN.
* Fixed gravity of Kerbin. (facepalm)
* Fixed bug where small payloads would not get the most efficient setup.

Version 1.0 - January 5, 2014
* Initial release.

Roadmap

There's still a few things I'd like to add to this tool before I'm done:

  • Support parallel staging (all stages fire at same time)
  • Add option for adding size adapters
  • Serialize and output arguments used (for debugging)
  • Output stats of parts in the parts list (for debugging)
  • Add parts from other mods
  • Support per stage settings
  • Quickly toggle parts by size or science node

Support This Project

Find this tool useful? Like to see it continually supported?

I am a self-employed software developer who built this in my free time. Unfortunately, I can't work on stuff like this all the time as I have to make money to eat and live. With your support, I can continue working on this and other great tools for Kerbal Space Program that everyone can benefit from!

Please click the "Donate" link on the web app to support this project! Thanks!

Copyright © 2013, Gary Court. All rights reserved. Licensed under the BSD License.

Edited by GaryCourt
Link to comment
Share on other sites

Yikes, this managed to overheat my laptop. And it's not producing correct results, just comparing a few single-stage reference points to my data here: http://forum.kerbalspaceprogram.com/threads/45155-Mass-optimal-engine-type-vs-delta-V-payload-and-min-TWR

Say for example I want a 40 kg payload (just the smallest probe, nothing else), 4000 m/s dV, min TWR 1.2 relative to Kerbin (surface gravity on Kerbin is 9.81, it's the Isp-to-exhaust-velocity conversion factor that is 9.82). The mass-optimal design here is one 48-7S and one FL-T100, whether or not you include the decoupler before the payload (would be nice to turn that off, otherwise I'll always be subtracting 15 kg from my payload since that decoupler's not needed) - the mass there is 0.7175 tons (for KSP use tons is much more commonly used than kg, a lot of people won't realize they need a factor of 1000 in there) with a decoupler, or 0.7025 without.

With all stock parts, your tool is telling me an RT-10 SRB is best. That's 3.803 tons. If I disable SRB's, then it's telling me to use a Skipper and 12.5 tons of fuel, 18.118 tons total mass. Disabling the Skipper I get 4x Mark 55 (which are never mass-optimal!) and total mass 19.405 tons. Then it tells me I should use a mainsail, then nothing. So I suspect something's up with your fuel consumption or delta-V calculations for small engines.

I applaud the effort, and I've been thinking for a while about making a tool like this for multi-stage design optimization. I have something that works quite well for my own use, but it's using a combination of Matlab and C++ libraries and has no user interface that anyone else could easily understand. While JavaScript is great for running in a browser and providing an easy-to-use interface without any installation, it's a really terrible language for computationally intensive numerical calculations like this one. There are considerably more effective algorithms for approaching this kind of optimization problem that I've been using successfully, but they're not the kind of thing you would ever write in JavaScript.

Link to comment
Share on other sites

Very nice - Found 57 'solutions' pretty quickly on my high end PC. I'll need to test some of those configurations to see how they work. :)

You might want to add a sort button. I don't mind having 57 solutions - in fact, its awesome, but if I could sort on the ones that give me the highest dv then that would be helpful. Cheers!

Link to comment
Share on other sites

So maybe I'm reading this wrong:

Optimise for Mass; Payload = 12.38; dv = 5545; Local G = Kerbin; min TWR = 1.5; Max stages = 9 (I have a fast PC). I ticked asparagus but not atmospherics.

I stopped calculating when a 8505 dv solution came in - attempt #4.

Attempt #4

Mass: 32540

Stages: 2

Delta-V: 8505

0 Payload: 12.38kg

1

TR-2V Stack Decoupler

RT-10 Solid Fuel Booster

2

TR-2V Stack Decoupler

FL-T400 Fuel Tank

Rockomax X200-8 Fuel Tank

Rockomax X200-32 Fuel Tank

Rockomax 'Skipper' Liquid Engine

How is that craft suppose to look? A straight up and down craft? I assume asparagus was not a part of attempt #4? MJ reports a dv of only ~3000, which is not even enough to reach orbit. Cheers. This might be the coolest tool ever. :)

Link to comment
Share on other sites

Yikes, this managed to overheat my laptop.

And drain your battery no doubt.

(surface gravity on Kerbin is 9.81, it's the Isp-to-exhaust-velocity conversion factor that is 9.82)

$#|%! My bad. I can't believe I never noticed that. Now fixed.

(for KSP use tons is much more commonly used than kg, a lot of people won't realize they need a factor of 1000 in there)

Yea, I didn't think of that. I switched everything over to use tons now.

Say for example I want a 40 kg payload (just the smallest probe, nothing else), 4000 m/s dV, min TWR 1.2 relative to Kerbin. The mass-optimal design here is one 48-7S and one FL-T100, - the mass there is 0.7175 tons with a decoupler, or 0.7025 without.

With all stock parts, your tool is telling me an RT-10 SRB is best. That's 3.803 tons. If I disable SRB's, then it's telling me to use a Skipper and 12.5 tons of fuel, 18.118 tons total mass. Disabling the Skipper I get 4x Mark 55 (which are never mass-optimal!) and total mass 19.405 tons. Then it tells me I should use a mainsail, then nothing. So I suspect something's up with your fuel consumption or delta-V calculations for small engines.

Thank you for noticing this! It turns out there was a bug that would occur for tiny payloads. It's now been fixed.

whether or not you include the decoupler before the payload (would be nice to turn that off, otherwise I'll always be subtracting 15 kg from my payload since that decoupler's not needed)

That's a good idea actually. Done!

I applaud the effort, and I've been thinking for a while about making a tool like this for multi-stage design optimization. I have something that works quite well for my own use, but it's using a combination of Matlab and C++ libraries and has no user interface that anyone else could easily understand. While JavaScript is great for running in a browser and providing an easy-to-use interface without any installation, it's a really terrible language for computationally intensive numerical calculations like this one. There are considerably more effective algorithms for approaching this kind of optimization problem that I've been using successfully, but they're not the kind of thing you would ever write in JavaScript.

That sounds like a challenge ;)

Thanks again!

Link to comment
Share on other sites

You might want to add a sort button. I don't mind having 57 solutions - in fact, its awesome, but if I could sort on the ones that give me the highest dv then that would be helpful. Cheers!

The list is already sorted, and you can choose the order by changing the "Optimize for" setting at the top. It wouldn't make sense to sort by dV as you would end up getting infinitely larger rockets.

Link to comment
Share on other sites

How is that craft suppose to look? A straight up and down craft? I assume asparagus was not a part of attempt #4? MJ reports a dv of only ~3000, which is not even enough to reach orbit. Cheers.

Yes, it would be a single stack. This attempt has no asparagus because the design chose a solid rocket booster which can't be asparagused to.

However, more importantly, you entered the weight as tons when (at the time) the tool expected kilograms. I realize people are likely to make this mistake frequently, so I change the tool to accepts tons now. Try it again.

This might be the coolest tool ever. :)

Thanks so much! :)

Link to comment
Share on other sites

Thanks, hiw is it sorted? By mass in accending order?

Id like to optimise by mass, and then find the highest dv solution for that given mass. With 57 solutions available all geared for minimal mass for the target dv, i could choose a 4000 dv option or an 8000 dv option. I need to find those 8000 dv options at the top. :)

Edit: on second thought, its best as it is. Im just going to scan the top 5 each time and find the highest dv and go for that. An indicator on each stage to say if it is asparagus would be handy but. :)

Edited by togfox
Link to comment
Share on other sites

And drain your battery no doubt.

Well I was plugged in at the time, but anyway...

$#|%! My bad. I can't believe I never noticed that. Now fixed.

Well you may have had the 9.82 number in your head for good reason, the conversion factor to get fuel flow from specific impulse (EARTH_GRAVITY in your code) is actually 9.82 in KSP!

Also note that the fuel lines are massless.

Yea, I didn't think of that. I switched everything over to use tons now.

Thank you for noticing this! It turns out there was a bug that would occur for tiny payloads. It's now been fixed.

That's a good idea actually. Done!

Awesome, thanks! Tremendous improvement!

Looks like you aren't currently allowing drop-tank stages without any engines on them? I'm finding some stages getting LV-1 engines added to them when the TWR constraint would still be satisfied without them.

Some future enhancement ideas:

1. Allow optimizing for total part count as an option

2. TWR constraint on a stage-by-stage basis, or (more complicated) min TWR as a function of cumulative delta-V

3. Optional constraints on max mass and/or max total part count

4. I'll have more later, I'm sure

Again, nice work!

Link to comment
Share on other sites

Well you may have had the 9.82 number in your head for good reason, the conversion factor to get fuel flow from specific impulse (EARTH_GRAVITY in your code) is actually 9.82 in KSP!

Oh! I had them swapped. That makes more sense now.

Also note that the fuel lines are massless.

Are you sure? The part.cfg file says "mass = 0.05".

Looks like you aren't currently allowing drop-tank stages without any engines on them? I'm finding some stages getting LV-1 engines added to them when the TWR constraint would still be satisfied without them.

Yea, something I had disabled at one point for testing. Fixed.

Some future enhancement ideas:

1. Allow optimizing for total part count as an option

2. TWR constraint on a stage-by-stage basis, or (more complicated) min TWR as a function of cumulative delta-V

3. Optional constraints on max mass and/or max total part count

I'll add it to the list. But I am hesitant on adding stage specific configurations for fear of making the tool too complex. Perhaps I need an advanced mode.

Again, nice work!

Thank you!

And thanks for your help on this! Your original graphs are what inspired me to write this tool.

Link to comment
Share on other sites

Are you sure? The part.cfg file says "mass = 0.05".

As blizzy78 said, fuel lines and struts are treated differently than other parts by the physics engine.

And thanks for your help on this! Your original graphs are what inspired me to write this tool.

Happy to help, glad my critiques are coming across as constructive (my posts tend to have a more negative tone than I intend them to...) and my charts were a source of inspiration. It would be cool if there were a similar general-purpose visual way of showing multi-stage solutions, but I haven't been able to find one yet.

Just say the word if you want me to start rambling about the math and open-source C++ code behind the more sophisticated optimization algorithms I've been using for multi-stage design optimization.

Edited by tavert
Link to comment
Share on other sites

Trying to work out how the asparagus works - like, I know what that means, (fuel fed in one tank at a time and dropped), but an asparagus stage by definition doesn't have engines. Your calculator shows asparagus stages with engines. Or is that to read that the whole stage has an engine and the tanks listed need to be asparagused? In that case, there isn't enough decouplers.

* continues to tinker *

Edit: And another puzzle. Stage one has three decouplers with three tanks and three engines (easy to do - asparagus turned off as it confused me). Stage two then goes to eight decouplers, tanks and engines. From 3 to 8. Ugh. That breaks symmetry. I'll skip that 'solution' and try the next.

Edit: The stage decouplers would be in a seperate stage to be more helpful when moving the design to the VAB. So stage zero is payload plus decoupler. Stage 1 is tank + engine + stage 2 decoupler etc. Just move each decoupler up one stage and it better matches the VAB staging. :)

Edit: Just worked out you can run mutliple calculations eg run a calculator for payload and skycrane. Then run another calc for skycrane + payload. Then run another and another etc. So the first payload is just the payload. Then the skycrane becomes a part of the payload etc etc. I wander if that will return a different result?

Edited by togfox
Link to comment
Share on other sites

Trying to work out how the asparagus works - like, I know what that means, (fuel fed in one tank at a time and dropped), but an asparagus stage by definition doesn't have engines. Your calculator shows asparagus stages with engines. Or is that to read that the whole stage has an engine and the tanks listed need to be asparagused? In that case, there isn't enough decouplers.

Typically asparagus does mean you drop both engines and fuel tanks, feeding the remaining engines from that same tank before you drop it. If you're just dropping fuel tanks without any engines on them, that would be called a "drop tank," and isn't the same thing as asparagus staging.

Link to comment
Share on other sites

NOTE: I did not read all comments!

How about an option to only use one diameter in a stack?

So i do not get options like:

FL-T400 Fuel Tank x2----medium diameter

Rockomax X200-16 Fuel Tank x2----big diameter

LV-T30 Liquid Fuel Engine x2----medium diamter

and automatically replace the X200 with some medium diameter tanks.

The main problem is: if you do this on your own, the calculations will not be correct, because the sum of the medium tanks is more than an, for example X200 ;)

EDIT:

I maybe have found a bug... :/

Settings:

mass

10t

12000

Eve

1.2

3

Asperagus

atmospharic stats

decoupler

Disabled parts:

Rockomax 'Mainsail' Liquid Engine

LV-N Atomic Rocket Motor

R.A.P.I.E.R. Engine

Toroidal Aerospike Rocket

Rockomax Mark 55 Radial Mount Liquid Engine

Rockomax Jumbo-64 Fuel Tank

ROUND-8 Toroidal Fuel Tank

Oscar-B Fuel Tank

According to the display at the bottom of the page, more or less plenty of solutions are found.... but it does not display any of these... :/

also if i set the maximum number of stages to 1, it says "Most Optimal Rocket Design Found!", but it does not display anything!! :(

EDIT:

it seems, that it does display a random number of found desings(in case of 1 stage, a "optimal desing"), if the setting is impossible

---> Definitly a bug! ;)

Edited by stoani96
Link to comment
Share on other sites

NOTE: I did not read all comments! How about an option to only use one diameter in a stack?

That's already on the roadmap (in the first post).

According to the display at the bottom of the page, more or less plenty of solutions are found.... but it does not display any of these... :/

also if i set the maximum number of stages to 1, it says "Most Optimal Rocket Design Found!", but it does not display anything!! :(

EDIT:

it seems, that it does display a random number of found desings(in case of 1 stage, a "optimal desing"), if the setting is impossible

---> Definitly a bug! ;)

Actually, it's an intended feature. For a particularly hard problem (such as Eve), a lot of the "solutions" don't work or fail to meet your specified restrictions, even though it was generated as "the best I could do". When I had it such that the number only updated when it found a valid solution, it looked like the app had frozen. So instead, it now increments the number (to show that it's doing work), even if it's not finding valid solutions.

Link to comment
Share on other sites

Just pushed out a big update to KORC tonight:

* Added Part Count optimization, with a secondary optimization criteria.

* Added field for changing the maximum amount of symmetry allowed per stack.

* Added option for forcing the last stage to be a single stack.

* Added option for forcing all tanks & stack decouplers in a stage to be the same size.

* Added option for forcing all tanks & stack decouplers in a stage to be the same size as the engines (except radial engines).

* Added additional summary fields to the header of search results.

* Small visual change to search results.

* Added part sizes to Stock parts data.

* Fixed symmetry issues with multiple stages of radial parts. Makes rockets much easier to build.

Enjoy!

Link to comment
Share on other sites

  • 2 weeks later...
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...