shadowmage45 / SSTULabs

Dev repository for testing/unfinished KSP parts/plugins/etc.
Other
62 stars 41 forks source link

Vacuum Engine ISP Rebalance #594

Closed MikeOnTea closed 6 years ago

MikeOnTea commented 6 years ago

First, i hope you're not annoyed by such "trivial" balance reports like this - one of the things i try to do in-game is to build cost efficient rockets, so i do sometimes notice things like this.

Having unlocked the J-2X some time ago, i noticed it was much more expensive than the J-2, more so than what i expected from the increase in stats. I also noticed the very good sea level Isp, even though this is an upper stage only engine (irl and according to in-game description). I've googled a bit but couldn't find any info on the irl IspSL, but according to the nozzle area ratio and chamber pressure i'd assume a sea level Isp more in line with a typical upper stage only engine.

Today i took the time and did some basic plots, containing the J-2X with current and with adjusted price, the latter denoted by the asterisk: Engine cost efficiency plots

As can be seen, the J-2X is easily the most expensive upper stage hydrolox engine per vacuum thrust or vacuum thrust * Ispvac, even quite a bit more expensive than the clearly better and irl very expensive RS-25. If the sea level isp/thrust get toned down, i suggest a cost of around 7200-7300 (i used 7250 in the plot for the asterisk variant). Even if it gets to keep the high sea level performance, it should probably cost around 8000 to not be overpriced compared to the RS-25.

MikeOnTea commented 6 years ago

I found some info, NASA says the J-2X would be destroyed if started on the ground in flight configuration (= with nozzle extension) and that a ground-startable version with a shorter nozzle extension would have less vacuum Isp, around 436s. This post basically says the same for the non A5 RL-10 variants. This probably means that the J-2X along with the non A-5 RL10 sea level Isp should all be nerfed to merlin-xV levels, ≤ 10s!?

blowfishpro commented 6 years ago

@MikeOnTea the issue with that is that simply putting the SL Isp very low would give the wrong numbers in the upper atmosphere. The problem with starting a vacuum engine at sea level is that the exhaust flow separates from the nozzle. But if you take the variation in Isp through the operating range and extend it down to sea level, it would be about the same as if it worked at sea level with no flow separation. So I think what you really want is a curve which is straight through the operating range and then abruptly drops to almost zero.

MikeOnTea commented 6 years ago

Good point and idea, blowfish. I don't know though whether we can find infos about roughly where that cutoff-point should be and how the curve should look above that in the operating range, but i'll try googling for infos.

blowfishpro commented 6 years ago

Yeah, admittedly the information you need to do this right is not widely available. Depending on what sources you use, is appears that flow will separate when the exit pressure drops below somewhere between 10% and 40% of ambient. But then you also have to know the exit pressure, which isn't usually available and can't really be calculated without simulating the engine.

shadowmage45 commented 6 years ago

I've long thought that the SL-ISP of 'vacuum' engines should be... non-existent. There are often no published numbers, and from my understanding of the physics involved, the performance would range from 'non-existent' to 'likely to just explode'.

However @blowfishpro brings up a good point -- while the usability of these engines at sea-level is a big 'no' due to instabilities, the 'theoretical, by-the-numbers' ISP is probably not 'that low' either (100-200'ish? entirely guessing). At the point where the exhaust stabilizes the ISP is certainly greater than zero, and probably a good portion of the vacuum ISP.

I would think that a decent curve could probably be found for these engines that gives them unusable thrust/ISP at sea-level, but returns them to decent performance in their intended use range. Probably start at 10% V-ISP for 'sea level' stats, slowly climbing for the first bit, say up to ~20% at ~5k alt, but then very quickly going up to >80% by 10k alt. The intent would be to make them useless as a lifter, but perfectly viable for 2n'd/upper-stage use, by simulating this point of 'start of stability'. (entire proposition is guessed at; a better model could be determined with a bit of statistical analysis with regards to atmospheric pressure and particular engine)

@MikeOnTea -- if you would like to take a stab at this, I'm willing to adjust some engine curves if a decently generic 'vacuum-engine' ISP curve can be derived.

In regards to cost -- I'm fairly open to cost adjustments. Currently they should all be mostly consistently cost-balanced based on their thrust output... but some engines might have been missed during the recent cost-balance pass. (the spreadsheet I use determines the engine cost based on thrust and a constant scalar applied to all engines; a couple receive further hand-tuning such as the extra-expensive RS-25).

MikeOnTea commented 6 years ago

Some good news, i found a rocket thrust simulator from NASA. With it, i think we are able to estimate nozzle exit pressure, and it even warns you when the ambient pressure is so high that there's a shock in the nozzle. It also gives you the Isp at various ambient pressures.

So, i used that tool to model curves for the RL10A-4 and the RL10B-2 as examples, using the shock warning pressure as the pressure above which the Isp of the engine is zero.

RL10A-4 curve:

    key = 0 451 0 -478
    key = 0.823 57 -478 -57000
    key = 0.824 0 -57000 0

RL10B-2 curve:

    key = 0 465.5 0 -1503.5
    key = 0.281 43 -1503.5 -43000
    key = 0.282 0 -43000 0

With these curves i plotted the Isp against the altitude on kerbin: ispaltitude Zoomed in to low altitudes: ispaltitudezoom

I think these results look quite good. Particularly nice to see that the RL10B-2 really has to pay for that huge nozzle/expansion ratio in low altitudes.

The cutoff point has to be determined for every engine individually as it depends on expansion ratio and chamber pressure, but as it only needs to be done for upper stage engines, i guess it's manageable.

Thoughts?

About the cost of the engines - yes, the hydrolox engines i plotted above all look pretty balanced, except for the J-2X, so might very well be possible that it was missed during the last balance-pass.

MikeOnTea commented 6 years ago

While modeling the J-2X curve, i realized i have to set the cutoff point higher – the warning from the simulator i used previously was at nozzle exit pressure below 5% ambient pressure, which would've made the J-2X almost ground-startable. After researching some more i found out that they ground test the J-2X with quite a reduced-length nozzle, and an intermediate-length nozzle together with a diffuser to simulate higher altitudes, but not at all with the real nozzle. So, i set the cutoff point now at 10% ambient pressure – if the engine exit pressure is below that, thrust/Isp is zero. This is still a fairly low pressure/cutoff point and i'm a bit unsure if we should increase it even more. For the currently plotted engines it's enough to prevent their ground use though, i guess.

Plots: ispaltitude3 ispaltitude3zoom

A small detail: As i've been trying to get a curve for the J-2X and checked the tool against the J-2, i realized the sea-level Isp was too high. After some digging around i found a second, lower chamber pressure value for the J-2 – i assume that to be a sea level value, because with that put in the simulator, i get the correct sea level Isp – and it can make sense as the J-2 has an open gas generator cycle, and the generator/turbine has to fight the ambient pressure as well. I've thus assumed that the J-2X also has an equally lower chamber pressure at lower altitudes, which might or might not be true, but it shouldn't reduce low-altitude-performance too much. I've not assumed the same for the Merlin 1DV, because that seems to use the same hardware as the 1D which does seem to have the full chamber pressure at sea level.

Feedback welcome. If we can agree on those curves, i'll try to do the rest of the upper stage engines. Should i open a new ticket for the curve rebalance, by the way, as it is not only J-2X related anymore?

taterkerman commented 6 years ago

Yeah, it's tricky. Also, how does KSP deal with non-vacuum Isp on worlds other than Kerbin?

Vac engines on Mars/Duna are not so troublesome.

What they likely need is a failure mode (maybe this will standardize once the add-on is a thing) such that at an ambient pressure >X, they blow up.

MikeOnTea commented 6 years ago

The curves are all pressure based, so the engines should work fine on mars/duna at surface altitude while you're out of luck on venus/eve. :)

shadowmage45 commented 6 years ago

@MikeOnTea Can leave the vacuum-engine rebalance stuff in this ticket. I'll update the name appropriately, and split of the cost-updating to a new ticket (err...how bout I just fix it now and call it done... :) -- updated to 7250 for now).

For reference, here is the full engine-stat sheet... which may or may not have some holes in it (note the cost specified in the sheet differs greatly from those in the parts... I may have not even done the last cost-update pass at all...).

Name Bell Dia Mass Exp.Ratio Cyle Use SLT-KN VT-KN SLTWR VTWR SISP VISP FUEL K-Diam VI/SI K-VTWR K-ST K-VT K-Mass K-Heat Available Cost
LMAE/RS-18 0.86 82 0 PF US 10 16 12.19512195 19.51219512 255 311 UDMH 0.5504 1.220 4.88 4.10 6.55 0.13 73.17 1 32.768
AJ10-190(Shuttle-OMS) 1.09375 117.93392 0 PF US/T 20 26.7 16.95864939 22.63979693 260 330 UDMH 0.7 1.269 5.66 8.19 10.94 0.19 84.90 1 54.6816
Kestrel 0.6 52 0 PF US/T 20 31 38.46153846 59.61538462 265 317 UDMH 0.384 1.196 14.90 8.19 12.70 0.09 223.56 0 63.488
LMDE/TR-201 1.38 179 16 PF US/T 30 45 16.75977654 25.1396648 255 311 UDMH 0.8832 1.220 6.28 12.29 18.43 0.29 94.27 1 92.16
HM7B 1 165 83.1 GG US 45.04035874 64.8 27.29718712 39.27272727 310 446 HLOX 0.64 1.439 9.82 18.45 26.54 0.27 147.27 0 132.7104
RL10A3 1.0575 131 64 EXP US 35 66 26.71755725 50.38167939 35 450 HLOX 0.675 12.857 12.60 14.34 27.03 0.21 188.93 1 135.168
RL10A5 0.23 120 4 EXP L 60 66 50 55 373 412 HLOX 0.1472 1.105 13.75 24.58 27.03 0.20 206.25 1 135.168
LR81-8048 0.65 100 20 GG US 50 67 50 67 260 276 UDMH 0.416 1.062 16.75 20.48 27.44 0.16 251.25 1 137.216
LR81-8096 0.9 134 45 GG US 65 76 48.50746269 56.71641791 255 300 UDMH 0.576 1.176 14.18 26.62 31.13 0.22 212.69 1 155.648
SuperDraco 0.2 65 8 PF T 65 73 100 112.3076923 230 240 UDMH 0.128 1.043 28.08 26.62 29.90 0.11 421.15 1 149.504
SuperDraco-L 0.5 90 32 PF US/T 60 85.5 66.66666667 95 230 325 UDMH 0.32 1.413 23.75 24.58 35.02 0.15 356.25 1 175.104
RL10A4 1.25 168 84 EXP US 50 90 29.76190476 53.57142857 10 457 HLOX 0.8 45.700 13.39 20.48 36.86 0.28 200.89 1 184.32
AJ10-137(Apollo-SPS) 2.5 250 62.5 PF US/T 74 91 29.6 36.4 260 319 UDMH 1.6 1.227 9.10 30.31 37.27 0.41 136.50 1 186.368
RD-0146 0.71 242 0 EXP US 0 98 30.312 40.49586777 350 463 HLOX 0.4544 1.323 10.12 0.00 40.14 0.40 151.86 0 200.704
RL10B2 2.13 277 280 EXP US 60 110 21.66064982 39.71119134 5 465 HLOX 1.36 93.000 9.93 24.58 45.06 0.45 148.92 1 225.28
RL60 2.13 500 285 EXP US 217.5268817 289 43.50537634 57.8 350 465 HLOX 1.3632 1.329 14.45 89.10 118.37 0.82 216.75 0 591.872
RD-0124 2.4 572 0 OR-ST? US 191.40625 294 33.46263112 51.3986014 320 359 KLOX 1.536 1.122 12.85 78.40 120.42 0.94 192.74 0 602.112
RD-0110 2.24 408.5 82.2 GG US 207.8683036 298 50.88575363 72.9498164 280 326 KLOX 1.4336 1.164 18.24 85.14 122.06 0.67 273.56 1 610.304
Merlin-1A 0.9 370 14 GG L 325 370 87.83783784 100 254 289 KLOX 0.576 1.138 17.50 133.12 151.55 0.87 262.50 1 757.76
Merlin-1B 0.9 395 14 GG L 348 395 88.10126582 100 265 302 KLOX 0.72 1.140 15.00 142.54 161.79 1.08 225.00 1 808.96
Merlin-1BV 2.5 480 117 GG US 0 480 0 100 15 322 KLOX 1.6 21.467 12.50 0.00 196.61 1.57 187.50 1 983.04
Merlin-1C 0.95 480 16 GG L 422 482 87.91666667 100.4166667 267 305 KLOX 0.8 1.142 22.59 172.85 197.43 0.87 338.91 1 987.136
Merlin-1CV 2.5 520 117 GG US 0 520 0 100 10 336 KLOX 1.6 33.600 20.00 0.00 212.99 1.06 300.00 1 1064.96
LR-87-LH2 1.14 700   GG L 300 667 42.85714286 95.28571429 203 451 KLOX 0.7296 2.222 19.06 122.88 273.20 1.43 285.86 0 1366.016
Merlin-1D 0.95 470 16 GG L 654 742 139.1489362 157.8723404 282 320 KLOX 0.608 1.135 27.63 267.88 303.92 1.10 414.41 1 1519.616
Viking 1 826 0 GG L 670 750 81.11380145 90.79903148 260 290 UDMH 0.64 1.115 22.70 274.43 307.20 1.35 340.50 0 1536
LR-79 1.53 643 8 GG L 667 758.4435456 103.7325039 117.9538951 248 282 KLOX 0.9792 1.137 29.49 273.20 310.66 1.05 442.33 0 1553.292
Vikas 2.8 950 0 GG US   800 0 84.21052632 260 290 UDMH 1.792 1.115 21.05 0.00 327.68 1.56 315.79 0 1638.4
Merlin-1DV 2.5 525 165 GG US 0 805 0 153.3333333 5 347 KLOX 1.6 69.400 23.00 0.00 329.73 1.43 345.00 1 1648.64
H1 1.607611549 1000 8 GG L 836 947 83.6 94.7 255 289 KLOX 1 1.133 23.68 342.43 387.89 1.64 355.13 1 1939.456
RD-107A 0.73 1190 0 GG L 839 1019 70.50420168 85.6302521 263 320 KLOX 0.4672 1.217 21.41 343.65 417.38 1.95 321.11 1 2086.912
RD-107X 0.73 1190 0 GG L 839 1019 70.50420168 85.6302521 263 320 KLOX 0.4672 1.217 21.41 343.65 417.38 1.95 321.11 1 2086.912
RD-108A 0.73 1190 0 GG L 839 1019 70.50420168 85.6302521 263 320 KLOX 0.4672 1.217 21.41 343.65 417.38 1.95 321.11 1 2086.912
J2 2.1 1788 27.5 GG US 486 1033 27.18120805 57.77404922 200 421 HLOX 1.3 2.105 14.44 199.07 423.12 2.93 216.65 1 2115.584
LR-87-5 2.28 739 8 GG L 956 1096 129.3640054 148.308525 259 297 UDMH 1.4592 1.147 37.08 391.58 448.92 1.21 556.16 0 2244.608
J2X 3 2470 92 GG US 1000 1307 40.48582996 52.91497976 342 448 HLOX 1.95 1.310 13.23 409.60 535.35 4.05 198.43 1 2676.736
RD-253 1.5 1070 26.2 OR-ST L 1470 1630 137.3920502 152.3364486 285 316 KLOX 0.96 1.109 38.08 602.11 667.65 1.75 571.26 0 3338.24
NK-33/AJ26 2 1240 0 ?-ST ? 1510 1680 121.7741935 135.483871 297 331 KLOX 1.28 1.114 33.87 618.50 688.13 2.03 508.06 0 3440.64
RD-275M 1.5 1070 26.2 OR-ST L 1671 1832 156.1682243 171.2149533 288 316 UDMH 0.96 1.097 42.80 684.44 750.39 1.75 642.06 0 3751.936
RD-181 1.45 2290 37 OR-ST L 1920 2090 83.84279476 91.26637555 310 337 KLOX 0.928 1.087 22.82 786.43 856.06 3.75 342.25 1 4280.32
RS25 2.4 3526 69 FR-ST L 1859 2277 52.72263188 64.57742484 365 452 HLOX 1.54 1.238 16.14 761.45 932.66 5.78 242.17 1 4663.296
BE-4 1 4000 0 OR-ST L 1600 2400 40 60 200 250 MLOX 0.64 1.250 15.00 655.36 983.04 6.55 225.00 0 4915.2
RS68 2.43 6600 69 GG L 2935 3312 44.46969697 50.18181818 365 410 HLOX 1.56 1.123 12.55 1202.18 1356.60 10.81 188.18 1 6782.976
RS69 2.43 6500 69 GG US 2950 3400 45.38461538 52.30769231 365 415 HLOX 1.56 1.137 13.08 1208.32 1392.64 10.65 196.15 0 6963.2
RS69B 3.28125 8500 120 GG US 3100 3650 36.47058824 42.94117647 365 450 HLOX 2.1 1.233 10.74 1269.76 1495.04 13.93 161.03 0 7475.2
RD-180 3.15 5480 36.4 OR-ST L 3830 4150 69.89051095 75.72992701 313 339 KLOX 2.016 1.083 18.93 1568.77 1699.84 8.98 283.99 1 8499.2
M1 4.28 9068 0 GG US 3864 5335 42.61138068 58.83325981 310 428 HLOX 2.7392 1.381 14.71 1582.69 2185.22 14.86 220.62 0 10926.08
RD-270 3.4 3370 0 FF-ST L 6270 6710 186.0534125 199.1097923 301 322 UDMH 2.176 1.070 49.78 2568.19 2748.42 5.52 746.66 0 13742.08
F1 3.75 8391 16 GG L 6770 7750 80.68168276 111.3247765 265 310 KLOX 2.45 1.170 27.83 2772.99 3174.40 11.41 417.47 1 15872
RD-170 3.8 10750 36.87 OR-ST L 7257 7904 67.50697674 73.5255814 309 337 KLOX 2.45 1.091 18.38 2972.47 3237.48 17.61 275.72 1 16187.39
Raptor 3 8000 250 FF-ST L 7050 8400 88.125 105 321 380 MLOX 1.92 1.184 26.25 2887.68 3440.64 13.11 393.75 0 17203.2
F1B 3.31875 8000 10 GG L 8006 10230 100.075 127.875 270 305 KLOX 2.125 1.130 31.97 3279.26 4190.21 13.11 479.53 1 20951.04
RS-27 1.7 1147   GG L 890 1054 77.59372276 91.89189189 255 302 KLOX 1.088 1.184 22.97 364.54 431.72 1.88 344.59 0 2158.592
LR-105 3.05 460 25 GG L 269 386 58.47826087 83.91304348 220 316 KLOX 1.952 1.436 20.98 110.18 158.11 0.75 314.67 0 790.528
LR-89 1.53 720 8 GG L 726 822 100.8333333 114.1666667 256 290 KLOX 0.9792 1.133 28.54 297.37 336.69 1.18 428.13 0 1683.456

EngineData.xlsx

shadowmage45 commented 6 years ago

As to the proposed curves -- they seem about appropriate to me, though I'm not sure how well KSP will cope with the 0's for ISP below certain altitudes.

Have you tried using any of the new curves in-game?

The one adjustment I might make would be to come up with a slightly more gradual setup -- rather than having strictly 0 ISP below a specific altitude, setup the tangents/keys in such a way as to have a much more gradual lead-in; so the ISP is non-zero at low altitudes, but effectively useless.

I would agree with @taterkerman that this would be a prime candidate for a failure mode for these engines. I'm generally not a fan of 'random' part failures... but player-induced failure through misuse of the part is perfectly acceptable. I suppose in the absence of failure modes, having zero ISP would effect mostly the same outcome (minus the explosions...and retaining a functional engine that could be used later).

MikeOnTea commented 6 years ago

I made a short test flight firing 2 RL10 engines and SRBs as lifters from the ground to the operating range of the RL10s, and it seemed to be working fine. Can think about/try a slight lead in though.

shadowmage45 commented 6 years ago

If the 0's work, then it seems fine to go with that.

Any idea how RO handles the vacuum engines? There has generally been quite a bit of research behind the values they use, and I'm kind of curious as to how they have set them up. Might give you a few more data points to work with.

blowfishpro commented 6 years ago

I don't recall RF/RO having any special handling for flow separation.

MikeOnTea commented 6 years ago

Hehe, before doing any work on this, i actually checked ROs Isp curves hoping they might've already done the work, but not so – their vacuum engines seem to work fine on the ground, unless they have some different feature like part breakage. I might ask them about the matter and see what they think, and i will run some further tests with the 0s.

MikeOnTea commented 6 years ago

A few observations: Engines with 0 Isp use their fuel and get hot, but don't have any exhaust plume. KER displays 0 delta-v and NaN for the first mass value (second works though) for mixed stages containing 0 Isp engines. Stages with only 0 Isp engines aren't shown in KER's stage view in flight while at 0 Isp altitude. As you wouldn't want to mix upper and lower stages anyway with the new curves, nothing of that should really matter though, i guess.

shadowmage45 commented 6 years ago

The side effects such as those where why I was concerned with the strictly 0 isp.

I think many of those oddities may be reduced or eliminated by specifying a non-zero low-point (e.g. substitute 10ISP for the 0ISP in your graphs) -- this would give KER/MJ/etc -some- value to play with for the 'sea level' performance, while still rendering the engines 'all but completely useless' while at/near sea level.

MikeOnTea commented 6 years ago

Well, i guess i gonna use 10 Isp as a baseline then, easy to adjust the curves to that, and you get at least small engine visuals and no more NaNs. When i'm done, i guess a PR is preferable to posting the curves here?

shadowmage45 commented 6 years ago

If you are familiar/comfortable with the PR process, yes, please. Otherwise with something like this it is probably simple enough for me to patch it in manually if needed.

Yeah, I think the ~10 ISP is a good compromise to keep things stable from a code/calculation perspective, while still giving the desired effect concerning usability.

MikeOnTea commented 6 years ago

Just a quick documentation of the process i used to create the curves:

shadowmage45 commented 6 years ago

Sorry, got a bit busy and forgot to respond to your post on the PR re: the cutoff altitudes:

I'm fine with just adding a quick blurb to the engines stating 'vacuum-optimized, not startable at sea level' or similar. The altitudes you had posted for the few engines you calculated all seemed to be way below where I would expect the engine to be used anyway, so not really worth the trouble for now.

I'll work on getting this info added over the next few releases; no need for you to worry about it.

MikeOnTea commented 6 years ago

Yep, all the engines should work fine on second and higher stages, they just won't really work on first stages anymore, so most users probably won't even notice any change, which is good. :)