Jump to content

Generic Spaceplane Ascent: testers needed


Recommended Posts

I'm using kOS.

I've been working on a generic spaceplane ascent script pretty much since I found out about spaceplanes. "Generic" being relative, of course: I still need to declare which action groups to trigger when, for example, and I don't think I'll ever come up with a liftoff procedure that's fit for every plane.

(EDIT: script available for download ->here<-)

All that convoluted code looking at climb rate, TWR, intake air and whatnot has been made obsolete when I noticed that all good ascents happen to have a very similar pattern for time_to_apoapsis.

For a high-TWR plane, time_to_apoapsis hovers around 20 seconds for a good part of the ascent, then increases steadily. For a low-TWR plane, it's more like 15 seconds and increasing slower. I've written a script that just tries to keep a desired time_to_apoapsis (pitch up when too low, pitch down when too high, full throttle all the way) and am getting good results; and a very smooth trajectory too, where my previous script was oscillating quite a bit.

(I'm also slightly pissed because all the intricacies of climb rate and airspeed and whatnot are all neatly summed up in that single figure for time_to_apoapsis; which makes sense if you think about it, but a) I didn't think of that, only noticed it by chance, and B) all the spaceplane smarts that went into previous scripts apparently are for naught).

Now I wonder whether this is truly generic, or merely because all of my own planes are fundamentally similar in some way. Could you please have a look at time_to_apoapsis during your next flight, and tell me whether you notice a similar pattern?

Edited by Laie
Link to comment
Share on other sites

I also pay close attention to time-to-apoapsis once I've leveled off and start accumulating speed. Too high a value and the ship will pass through the prime acceleration altitudes without accumulating enough speed; too low and you run the risk of not being able to bring it up any further when thrust starts falling off. IME, the actual value for tta is less important than how that value is changing; if it is shrinking greater AoA is required, if it is increasing before you are near orbital speed less AoA is required.

My typical tta is about 10s when I level off at a bit over 20km. I try to keep it at around 15s through most of the ascent through 30km, after that I've usually gotten close to orbital speed and the tta starts growing. By the time my air-breathers flame out my Ap might be 90s away or more.

Disclaimers: Stock aero, and all my planes are high TWR (1.2 or more).

Edit: tta works for me, fixed.

Edited by Red Iron Crown
Link to comment
Share on other sites

Red: I'll stick to tta if you don't mind -- or is this already taken?

LethalDose: mostly the airbreathing part, from when the tta first gets high enough (which usually happens around 10km even with runway-TWR=1.1) to when I reach 2000m/s or have the first flameout.

Link to comment
Share on other sites

I've long done about what Red Iron Crown says, but I'm not convinced it's optimal. If you level out too soon, you end up using more fuel because you get stuck climbing slowly.

I suspect what you want is to set things up so that you end up at your top-speed altitude (where you use exactly 100% of your air) with enough time afterwards to get up to speed.

Link to comment
Share on other sites

My advice is not generic, that's for turbojet. For a basic jet you want to get altitude -- you can easily get over 36 km. You will never build up enough horizontal speed to write home about, so just get altitude and let the rockets get you the next nearly 2km/s horizontal.

Haven't tried with the rapier.

Link to comment
Share on other sites

I've long done about what Red Iron Crown says, but I'm not convinced it's optimal. If you level out too soon, you end up using more fuel because you get stuck climbing slowly.

I suspect what you want is to set things up so that you end up at your top-speed altitude (where you use exactly 100% of your air) with enough time afterwards to get up to speed.

The over 30,000m ascent path I use depends on TWR.

On a low TWR ship (nukes, mostly) I use a very flat ascent that ends up with the plane shutting off thrust while climbing ~50m/s at 50,000m on the way to a 70k apoapsis / 40K periapsis.

On a high TWR ship (RAPIERs, Aerospikes) I'll use a steeper final ascent and a longer circularisation burn. Use the flatter ascent with quick ships like these and you end up losing too much speed to drag after engine shutdown.

In either case though, it starts with a jet-powered climb to a minimum of Mach 4.5 / 30,000m. When possible, Mach 5.5 and 40,000m is even better. That's just the basic starting line for a spaceplane ascent.

Get to 20,000m however you like, then flatten out and build speed as you slowly climb until you're approaching Mach 5 and 30,000m. There are several ways to get there (smooth climb, arc and bounce, etc), but the need to build that speed is unavoidable.

Edited by Wanderfound
Link to comment
Share on other sites

I've long done about what Red Iron Crown says, but I'm not convinced it's optimal. If you level out too soon, you end up using more fuel because you get stuck climbing slowly.

I am not convinced it's optimal either. I can reliably get high TWR planes to orbit, but I haven't had much success with the lower TWR ones others seem to be able to get up there. I'm sure I'm carrying more engine than should be strictly required.

Link to comment
Share on other sites

Thank you for the information. I will try it and see if it takes some of the tedium out of my current spaceplane ascents, which is 20km, then start flattening out, then have a cup of coffee before 50km or so.

Link to comment
Share on other sites

I am not convinced it's optimal either. I can reliably get high TWR planes to orbit, but I haven't had much success with the lower TWR ones others seem to be able to get up there. I'm sure I'm carrying more engine than should be strictly required.

You need enough jets to get off the runway and reach Mach 4.5; you need enough oxidising thrust to maintain acceleration above 30,000m. Anything more than that is a luxury.

OTOH, I like my spaceplanes luxurious a lot of the time.

Link to comment
Share on other sites

I actually typically use a 2 rapier config, and level out at 11,000m. I try and gain as much speed as possible from there, keeping prograde marker 5degrees above the level plane. otherwise I find, I flame out too early...

But then again I've always been horrible at doing space planes, and only recently have I had some success (2-3 ton probe was biggest payload)...

After reading this I will probably reconsider...

Link to comment
Share on other sites

I can reliably get high TWR planes to orbit, but I haven't had much success with the lower TWR ones others seem to be able to get up there. I'm sure I'm carrying more engine than should be strictly required.

I think that's a question of having enough intakes.

If you don't need any power for lifting, you can move at sqrt(your_twr)*terminal_velocity. So with TWR=1 you can reach terminal velocity, with TWR=2 you can get up to 1.4 times terminal velocity, TWR=0.5, 70% termvelocity. (In stock atmo, and I'm not sure if that's 100% correct, but it comes pretty close).

Termvelocity at 30km is ~2000m; TWR of turbojets at 2000m/s is the same as on the runway. Therefore, if you want to get to 2000m/s@30km, you need a runway-TWR of 1. You'd also need enough intakes so all of your engines would run at full power -- I don't think anyone really does it this way. However, as you keep climbing, terminal velocity increases faster than SQRT(TWR) is decreasing (due to the power of SQRT, and only until flameouts make your TWR drop sharply).

That's why I think that the trick behind successful low-TWR spaceplanes is having enough intakes to keep going well beyond 30km without flameout. They also require some patience in getting to 12-15km.

I am not convinced it's optimal either.

I suspect that it can be pretty close to optimal.

I've been doing it the old-fashioned way: watching TWR, terminal velocity, climb rate and airspeed. Actually, the rate at which the airspeed changed -- which is easy to do, you quickly develop a seat-of-you-pants feel for how quickly the numbers are supposed to change. If it doesn't seem right, you either pitch up (get into thinner air) or down (because you're already higher than you ought to be and need to catch up on velocity).

Teaching that to a kOS box was quite a mouthful, and in the end it was climbing stairs: up for a while, forward for a while, then up again.... surprisingly, this looked much more ugly than it actually was. In terms of flight time and fuel used, it was well within the margin of error of my manual flights. So getting it smoothed out was more of a cosmetic thing I didn't tacle for a long while, but when I did, I noticed the TTA affinity; and now that I'm flying by TTA alone (completely ignoring all other parameters), I'm again getting similar-to-better results.

Now, maybe it only seems good to me because I'm such a bad pilot; or maybe it only works for the kind of planes I'm building. I'm asking all spaceplane pilots to fly as usual, as they think is best, but to keep an eye on their TTA while doing so, and tell me what it's doing.

Link to comment
Share on other sites

You say that so much.

What speed is it? At what altitude?

I'll get you at playtime! (eg; PM) *grin*

m/s is "a thing" and can be displayed in KSP, Mach X isn't, and can't.

Mach 1 equals roughly 350m/s, but, as you know, varies with pressure. Both FAR and Kerbal Flight Data display speed in Mach, and it's usually FAR flyers that I'm writing for. "Mach 5" is easier to write and understand than "about 1,700m/s" for me.

And, for the stock flyers, it doesn't hurt to encourage them to look up Mach numbers and realise that 400m/s is not as slow as they usually think it is.

Link to comment
Share on other sites

I just flew a biggish ship up to orbit. 96 radials + 6 rams -- might be risking a charge of intake spam with this one -- 40t on the deck, three turbojets, liftoff speed about 60 m/s.

Roll off, maintain 45 degrees until vertical speed hits 200 m/s, then keep the tta steady.

It didn't quite work as planned: I overshot the apoapsis once I ran out of air, fell back down to 33km where I could fire on all three cylinders, and was able to be going fast enough on the second go so that even with vertical speed just 100m/s, tta was increasing.

Link to comment
Share on other sites

Thank you for the information. I will try it and see if it takes some of the tedium out of my current spaceplane ascents, which is 20km, then start flattening out, then have a cup of coffee before 50km or so.

Hold on a second. Following the TTA pattern will not lead to a better/faster/more efficient ascent. At best, it will lead to an ascent that's just as good, fast and efficient as one where you consider all the flight parameters.

I just flew a biggish ship up to orbit. [...] Roll off, maintain 45 degrees until vertical speed hits 200 m/s, then keep the tta steady.

It didn't quite work as planned: I overshot the apoapsis once I ran out of air

If you were going up until climb rate was 200, your TTA was already quite high at that point. Maintaining that high TTA can't end well.

For my planes, the TTA pattern can be easily modeled with a simple formula, like "maintain TTA of 14 or (apaopsis/1700) seconds, whichever is higher". That's nice and fine for a kOS machine, being able to look at /correct for a single parameter makes the script quite simple, but I don't know if it's all that useful for a human pilot.

The above formula is a bit simplistic, but usable. It also needs to be different for every plane, but seems to be entirely TWR-dependent. The above figures work (for me!) for a runway-TWR of 1.1; if TWR was 2, the starting value would be 20, the divisor 1000.

As said above: right now, I'd be more interested in you flying as you always do, but keeping an eye on TTA and telling me what it does during your ascent. I'm wondering whether this strong-and-simple relation is truly a generic thing, or only a property of my planes.

"And that's where you come in".

Link to comment
Share on other sites

Alright, here goes:

If your plane meets the following conditions, You can run the script as is and it should take you to orbit without wasting a lot of time or fuel:

  • jets toggled on action group #1
  • rockets toggled on action group #2
  • all engines in one stage
  • controllable through Smart A.S.S.
  • enough jet power to get to 2000m/s
  • runway TWR > 0.7 (less might still work... it should definitely be able to climb at 25m/s, though)

If your design uses different action groups, you'll have to adapt the script accordingly.

Download Here

(requires kOS Autopilot)

Staggered shutdown of several groups of jets is no problem. I haven't tried hybrid models that use basic jets as well as turbos, but don't see why they shouldn't work. The default flight plan is of the "one size fits nobody" category: it gets the job done reasonably well for every plane I came up with, but that's it. If you want more than "reasonably well", you'll have to modify the flightplan. Which isn't very difficult.

Just to give you an idea of what a flight plan looks like, this is the default:

(See the comments in the script & readme file for a detailed description of everything.)


when maxthrust > 0 then {
toggle ag2. // rocket off
set mode_trig to "climbing".
when alt > 500 and tta > ttta then {
set mode_trig to "tta".
set minp to 5.
set tmin to 1.
when v > 1900 then {
set mode_trig to "climbing".
set fac to (2000-v)/(55000-alt).
set const to v-fac*alt.
lock vtgt to round(max(2000,(alt*fac+const))/vter,2).
set t to 0.5.
set tmin to 0.1.
set maxp to 25.
when flout >=1 then {
toggle ag1. //jets off
toggle ag2. //rocket on
set mode_trig to "tta".
set maxp to 35.
lock minp to round(min(maxp,((75000-apo)/2500))).
lock tmin to round((40000/apo)^3,2).
lock ttta to round(apo/800).
set flout to 0.
when obt:period > 28*60 then {
set tmin to 1.
}}}}}}

The resulting flight path will look somewhat similar to this:

(note the bumpiness around 32km -- a better flight plan would save time and fuel)

ssto.gif

Have fun, and tell me how it works for you -- especially if it doesn't.

Link to comment
Share on other sites

  • 4 weeks later...

Laie: do you get a lot of oscillation with the basic steering lock? i would think it would be poorly suited for an ssto. Have you ever used the raw controls?

Update: You should build a landing script ;)

Update2: good work on this, do you mind if i use it as a test script for kos? we are trying to build a suite of complicated scripts to test for regression.

Edited by erendrake
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...