Jump to content

[WEB] [1.1.1] Optimal Engine Charts interactive webapp


Recommended Posts

 

Optimal Engine Charts

An interactive webapp for Kerbal Space Program v1.1.1

>> New URL: http://meithan.net/KSP/engines/ <<

YpIWfRc.png

Current app version: v1.1.2
Github project: https://github.com/meithan/engine_charts


This webapp will let you compute interactive optimal engine charts on demand. They are meant to answer this general question:

  • What is the optimal engine for a given payload mass and desired Δv, subject to a minimum TWR (or acceleration) restriction, where by optimal we mean that the resulting ship should have the least possible mass?

The calculations include the dry mass of the tanks and consider a variable number of engines to satisfy the TWR restriction. The purpose of these charts is not to design the ship for you (there are tools for that), but to provide general guidelines about which engines are the best choices for a wide range of circumstances.

These charts are inspired by tavert's original engine charts, which I continued (with a different approach) and expanded for 1.0 in a previous post.

 

How to use the app

Basic instructions:

  1. Choose a fixed variable out of Payload mass, Minimum TWR or Delta-v. The remaining two variables will be on the axes of the 2D plot.
  2. Fill in the chart parameters, including payload and Δv ranges, minimum TWR, atmospheric pressure and maximum number of engines.
  3. Select the engines that should be included in the analysis.
  4. Click "Calculate!" and the chart will appear; details will be shown on the panel to the right.

You can get more help by opening the collapsible areas by clicking on the NFNajr8.png buttons. Some extra details are also given by mousing over the lHS0fQw.png tooltips.

The chart is interactive:

  • Mouse over the chart to see details for the point under the mouse in the panel to the right.
  • Click on the chart to lock the details panel to a specific point in the chart; click again to unlock.
  • Click-and-drag to pan the currently displayed view; the chart will be recomputed with the new ranges.
  • Hold the CTRL key and click-and-drag to zoom the chart to the selected area.
  • Use the button controls under the chart to change the ranges, recall previous settings or save the chart.

 

Further details and assumptions

  • Single-stage ship. As we all know, dropping mass is the way to reach higher Δv budgets, but I'm keeping it simple here. As a rule of thumb, above ~5000 m/s it's probably better to use multiple stages.
  • Ship has only one engine type, since testing all possible engine combinations would require a different approach.
  • "Payload" is defined as everything that is not the propellant, tanks or engines used to push the actual payload around. This means "payload" includes stuff like structural elements required to mate the actual payload to the tanks/engines.
  • Propellant quantity is treated as a continuous value, so tanks are considered infinitely divisible. While this is not entirely realistic, one could approximate this in practice by using a large numbers of small tanks. In this respect tavert's original analysis is still superior. This means that the analysis can be inaccurate for light (< 2 tonnes) payloads.
  • The thrust-to-weight ratio (TWR) restriction should be used to ensure solutions remain practical (sure, a single LV-N pushing 1000 tonnes will have fantastic Δv, but burns will take forever). Note that Kerbin-relative TWR is equivalent to minimum acceleration measured in standard gees.
  • Assumes the full-to-dry mass ratio of the tanks is 9 in general, except where noted. All "rocket" LFO tanks have this ratio in 1.0.4, while the "spaceplane" LFO tanks (i.e. Mk2-Mk3 tanks) have slightly worse ratios, very close to 8.
  • The change to liquid fuel-only for LV-N is accounted for, and I've used a tank full-to-dry mass ratio of 8 for it, which closely matches the ratios of the Mk2 and Mk3 liquid fuel-only fuselages.
  • The KR-1x2 "Twin Boar" liquid booster is treated by discounting 4 tonnes from its mass, which is the dry mass of one orange tank; the propellant it can carry and the dry mass of the tank are included elsewhere in the calculation.
  • The RAPIER is only considered operating in closed-cycle mode, i.e. "rocket mode" using liquid fuel and oxidizer.
  • For the O-10 monopropellant engine, I've assumed a full-to-dry mass ratio of 7, which is close to the average value for the larger tanks; the smaller tanks have worse ratios.
  • For the "Dawn" engine the full-to-dry mass ratio is assumed to be 2.3, roughly that of the xenon tanks. Also, by default the analysis will include an extra 100 kg of mass per engine, which accounts for the mass of the solar panels required to continuously operate the engine at Kerbin's distance form Kerbol. This extra mass can be turned off with a checkbox.
  • Engine specs for 1.0.5 are used throughout, extracted directly from the game's .cfg files.
  • Airbreathing engines and SRBs are left out of the analysis, for now.

 

Formulas

For a given desired Δv and payload mass (m_payload), the optimal (i.e. minimum) total mass of the ship for a given engine type is:

vxRIrJm.png

where m_engine is the mass of the individual engine, I_sp its specific impulse, g0 standard gravity (assumed to be 9.81 m/s^2), and the number of engines, n_engines, is given by

mqJ5rDE.png

where TWR_min > 0 is the minimum required Kerbin-relative thrust-to-weight ratio of the ship, TWR_engine that of the engine by itself, and 807e2debc359ab4b141d93f1b47e6742.png is the ceiling function, which indicates to round the result up to the next integer. If no TWR restriction is imposed (i.e. TWR_min = 0), n_engines is simply 1.

In these two formulas, the parameter alpha (α) is defined as the propellant-to-dry mass ratio of the tanks; it is equivalent to the conventional full-to-dry mass ratio minus one:

9sTrH8C.png

Finally, the calculation requires computing the maximum theoretical Δv of a the engines, which depends on α and the minimum TWR as

PVEL6Mg.png

Here's a plot of this quantity for some of the engines (click for larger image):

OXHJ2tnm.png

 

Planned/suggested features

  • Option to plot a different set of variables as the axes of the plot (e.g., minimum TWR vs. Δv for a given payload mass)
  • Option to determine optimal engine by propellant mass, not total ship mass
  • Ability to add user-defined engines
  • Cost information?
  • Engine pics
  • ... suggestions are welcome!

 

Changelog

Spoiler

Version 1.1.2 -- April 28, 2016

  • Updated engine stats to KSP 1.1.1 (no changes since 1.0.5 though).

Version 1.1.1 -- March 2, 2016

  • Changed default maximum number of engines to 10
  • Other minor fixes (e.g. default fixed variable is now correctly set, fixed min/avg/max row display in runner-up details).

Version 1.1.0 -- February 22, 2016

  • New feature: fixed variable selector. The user can now select which two variables to plot and which to hold fixed.
  • Moved project to Github repository.
  • Code refactoring.

Version 1.0.1 -- February 19, 2016

  • Updated engine stats to 1.0.5 (the only change is the addition of the Vector engine).

Version 1.0.0 -- June 30, 2015

  • Initial release.

License

The Optimal Engine Charts webapp is free software licensed under the GNU General Public License v3. You are free to use, distribute and modify this software as you see fit, subject to the provisions of the license.

Edited by Meithan
Link to comment
Share on other sites

You must spread some Reputation around before giving it to Meithan again.

Also, it seems that it considers a single "Thud" engine viable. Designing such a rocket is going to be interesting.

Edited by Mipe
Link to comment
Share on other sites

Meithan,

This is an awesome tool. Hopefully you will figure out a way to do recursive stages.

With such a great tool, you have to give us a way to contribute to helping you by adding more types of engines from mods. I would have put in 1/2 a dozen last night alone just to see what happened. I understand it could be tricky to let the general public have access to adding engines (due to errors being introduced), but if I could make a couple suggestions:

1) Add the fields for the general public to put a configurable test engine in instead of only stock choices.

2) Recruit some collaborators to help you put engines in.

3) Create a script that reads the part cfg file for an engine and auto-populates the data for the algorithm to use.

4) Add tabs to let collaborators add alternate planetary data (such as RSS, New Horizons, OPM, etc...)

Anyways, Thanks a bunch for this tool!

Link to comment
Share on other sites

Congratulations on release ;)

Thanks John!

Thanks! I'll use this to plan some super long distance/endurance interplanetary cruisers. :D

That's the idea ;).

You must spread some Reputation around before giving it to Meithan again.

Also, it seems that it considers a single "Thud" engine viable. Designing such a rocket is going to be interesting.

Under what conditions are you getting the Thud as optimal? I haven't seen it often.

Meithan,

This is an awesome tool. Hopefully you will figure out a way to do recursive stages.

With such a great tool, you have to give us a way to contribute to helping you by adding more types of engines from mods. I would have put in 1/2 a dozen last night alone just to see what happened. I understand it could be tricky to let the general public have access to adding engines (due to errors being introduced), but if I could make a couple suggestions:

1) Add the fields for the general public to put a configurable test engine in instead of only stock choices.

2) Recruit some collaborators to help you put engines in.

3) Create a script that reads the part cfg file for an engine and auto-populates the data for the algorithm to use.

4) Add tabs to let collaborators add alternate planetary data (such as RSS, New Horizons, OPM, etc...)

Anyways, Thanks a bunch for this tool!

Being able to add custom engines is a good suggestion. The programmatic part is easy; the not-so-trivial part is building the UI. Added to the "list of planned features".

Also, I do have a small Python script I use to read the part cfg files and create the relevant JavaScript code, which I copy/paste into the app. But what would be cool is being able to feed the cfg file to the app and have it automatically add the engine stats, right?

Link to comment
Share on other sites

Under what conditions are you getting the Thud as optimal? I haven't seen it often.

Low tech (only the first four medium engines unlocked), low payload (2 tons max), 0-5000 dv, 1.5 min TWR (Kerbin), 1 atm - the single Thud fills a lot of range.

Link to comment
Share on other sites

Also, I do have a small Python script I use to read the part cfg files and create the relevant JavaScript code, which I copy/paste into the app. But what would be cool is being able to feed the cfg file to the app and have it automatically add the engine stats, right?

Yessir. You might try asking for help if you need any from one of the IRCs. Either #kspmodders or #RO (Realism Overhaul - They were pretty interested in having this type capability to test their modded engines also for RSS launches.)

Link to comment
Share on other sites

Low tech (only the first four medium engines unlocked), low payload (2 tons max), 0-5000 dv, 1.5 min TWR (Kerbin), 1 atm - the single Thud fills a lot of range.

Ah, I see. It's a decent atmospheric engine.

The only problem I see is that it's radially attached, and for those conditions the efficient solution requires only one Thud, which is problematic :P.

Link to comment
Share on other sites

  • 4 weeks later...

Great tool, thanks

I've got two suggestions:

- pics of the engines would be nice, e.g. on mouse over (my mind works visual)

- to display a user editable payload fraction limit, e.g all colors <40% payload fraction are belted

Link to comment
Share on other sites

Great tool, thanks

I've got two suggestions:

- pics of the engines would be nice, e.g. on mouse over (my mind works visual)

- to display a user editable payload fraction limit, e.g all colors <40% payload fraction are belted

Pics of the engines added to todo list (I suppose Squad is OK with it?).

As for the payload fraction limit, do you mean graying out (or something) solutions with fractions below the limit? Or discarding solutions with fractions below the limit?

Link to comment
Share on other sites

Pics of the engines added to todo list (I suppose Squad is OK with it?).

As for the payload fraction limit, do you mean graying out (or something) solutions with fractions below the limit? Or discarding solutions with fractions below the limit?

Graying out or showing striped would be great.

Link to comment
Share on other sites

  • 2 months later...

Hi, Meithan!

What do you think about including the fuel-cell mode for Dawns taking into account the mass of fuel cells and LF/O?

A Dawn eats 0.048 kg/s of Xe and 8.74 e/s of electricity.

Fuel cells eat 0.0125 kg of fuel per unit of electric energy.

So, a Dawn powered with fuel cells consumes (0.048 kg/s of Xe + 0.10925 kg/s of LFO) = 0.15725 kg/s.

Isp = (thrust / consumption) / 9.81 m/s² = (2000 N / 0.15725 kg/s) / 9.81 m/s² = 1296.5 s

Fuel cell arrays are preferred over single fuel cells as they have 2.5 times less mass per electric power unit.

One Dawn engine requires 0.48555 fuel cell arrays which weigh 116.533 kg.

The problem is when using only one ion engine (very common case), you need only a half an array, but have to attach a whole one. So the tool will show a pretty wrong prediction. Maybe, it’s worth to count fuel cell arrays discretely?

Link to comment
Share on other sites

Hi, Meithan!

What do you think about including the fuel-cell mode for Dawns taking into account the mass of fuel cells and LF/O?

A Dawn eats 0.048 kg/s of Xe and 8.74 e/s of electricity.

Fuel cells eat 0.0125 kg of fuel per unit of electric energy.

So, a Dawn powered with fuel cells consumes (0.048 kg/s of Xe + 0.10925 kg/s of LFO) = 0.15725 kg/s.

Isp = (thrust / consumption) / 9.81 m/s² = (2000 N / 0.15725 kg/s) / 9.81 m/s² = 1296.5 s

Fuel cell arrays are preferred over single fuel cells as they have 2.5 times less mass per electric power unit.

One Dawn engine requires 0.48555 fuel cell arrays which weigh 116.533 kg.

The problem is when using only one ion engine (very common case), you need only a half an array, but have to attach a whole one. So the tool will show a pretty wrong prediction. Maybe, it’s worth to count fuel cell arrays discretely?

Hey Teilnehmer. What I can do is have the code compute solutions for the Dawn + fuel cells separately. I'll look into it when I get some time. I'm definitely interested in seeing the results.

Link to comment
Share on other sites

  • 4 weeks later...

Hello Meithan,

first of all: Thank you for such a great and usefull tool!

I like to play around with the math behind KSP, too (sometimes it distracts me from playing the game itself), so I grabbed the source of your webapp, learnt some HTML5 and experimented with it. I have a personal wishlist of features I miss in this app, some are already mentioned in this thread, but I thought, why don't implement them yourself?

So here are the points I have implemented so far:

  • For the general comparison of the engines a few diagrams
    • engine TWR over atm
    • engine Thrust over atm
    • engine ISP over atm

    [*]An option to allow or disallow the calculation of single radial mounted engines like the Mk-55 Thud

    [*]An improved version of the Isp calculation with regard to the tangents of the spline interpolation (the aerospike engine cfg file has those tangents explicitly set to a different value than the default ones)

    [*]some little bootstrap style tweaks, if you view the webapp on an smartphone or a very small browser window, the engine selection columns are not listed in an long list between the chart parameters and the chart anymore, but in a table like on bigger screens

Not every detail is finished, for example the dragging and zooming in the new diagrams dont work, I hacked it somewhere in code from the existent chart (with other units on the x and y axis), but its in a state where you can see what it should do and has its core functionality working

Some diagrams and features I didn't implemented yet, but I intend to do are:

  • the ion-engine/fuel cell combination with discrete number of engines and cells
  • a few more diagrams or heightmap charts, like max asymptotic deltav over min TWR (fix atm) or over atm (fix min TWR)
  • maybe solid Rocket boosters, although they need a different calculation concept (the amount of solid fuel is variable, but has a maximum per engine)
  • whatever comes to my mind

I'm not sure how to publish the results I have so far, they are to much modifications and the whole sourcecode is to big to embed it here, maybe you can publish his code on a github project, where i can fork/commit my changes to it, or I send you the file per mail and you merge the changes you like into your own website, or just looking at the ideas and coding it yourself.

Link to comment
Share on other sites

Hi, gfrodo. Thanks for your interest! I haven't had much time to work on the app.

The features you mention sound very nice. Can't wait to see them for myself. Engine curves are definitely something I've been thinking of doing. I didn't know the bit about the Aerospike tangents being different (we should write helper programs to parse this stuff directly from the game's cfg files). And the Bootstrap issue is something I am aware of but never fixed; I have another website (unrelated to KSP) with the same problem, so it'll be nice to fix it.

I definitely think we should collaborate on this. The best thing to do is for me to upload the project to github, so we can work from there. I'll try to do it during the weekend. I'll take the opportunity to do a bit of housekeeping on the code (for instance, separating the code from the html and organizing it into several source files).

I'll let you know when it's up.

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...
  • 2 weeks later...
  • 2 weeks later...

I’m making a similar web tool now.

In contrast to the Meithan’s one, it plots graphs by a single parameter only, but you can choose which parameter to plot by: payload mass, Δv, TWR or pressurre.
I also added SRBs to the engine list. The number of SRBs needed is calculated with taking into account both TWR and solid fuel amount.

Edited by Teilnehmer
Link to comment
Share on other sites

finally, I have a place to host my modified version of Meithans webapp. It has the new vector engine, a few options for the ion drive including fuel cells and some new diagram types (highly experimental).

http://firesurfer.de/gfrodo/ksp/engines/engines.html

You can use the webapp like before or try the new features, the new plots use the existing form inputs with a slightly different meaning, e.g. the Atmosphere input is for the x axis scaling and should not be 0 to see something.

Unfortunatly, I have very little free time right now, but I think, it is better than nothing. Maybe you can get some inspirations for your own tool, Teilnehmer.

 

Edited by gfrodo
Link to comment
Share on other sites

  • 1 month later...

Hi all!

After a long, long KSP dry spell, I'm finally back to the game a bit and also to development of the webapp. I'm pleased to announce that I just rolled out version 1.1 on my new webhost:

http://meithan.net/KSP/engines

So update your bookmarks, folks.

Apart from updating to KSP 1.0.5 engine stats and a lot of code refactoring, version 1.1 brings a new feature: the user can now select which variables to plot and which to hold fixed, out of Payload, Minimum TWR and Delta-v. It's common that one has a specific payload mass in mind, and wants to have an idea of what engines are good for a range of jobs. Or maybe one has a particular mission's delta-v in mind and wants to determine what engines would be appropriate for a range of payload masses.

I also uploaded the project to Github, for personal convenience and for code sharing (it's all GPLv3, of course): https://github.com/meithan/engine_charts. Feel free to browse the code, fork it if you so like or submit pull requests (@gfrodo will be particularly interested, I gather).

The next feature on the roadmap is to add alternative ranking choices for what's considered the "best" engine: I'm thinking propellant mass and tankage+engines total cost as obvious choices. It shouldn't be too hard to implement but let's see how the week's work comes out.

Cheers all, and thanks for your interest and support (bug reports welcome of course).

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...