Jump to content

Gravity Turn Optimization Problem


Lynch

Recommended Posts

12 hours ago, Lynch said:

ive been trying to solve this for 1 year, always got distracted by classes and other games

actually

 

 This problem is one of the reasons I decided to go for dual degrees in Applied Mathematics and Physics :wink:

 I originally started out in much the same position where your posts indicates you are... figuring out basic forces, a free body diagram, etc... but unfortunately basic kinematics isn't going to make life any simpler.  I moved on from there to the idea of using just vector calc, given that for a given arbitrary orbit one must have be in a specific position with a specific velocity vector, say V2... then your initial launch vector is V1, where vertical and along the latitude axis is zero, but you inherit the velocity from the spin of the planet.  This seemed a but more robust of a solution, at least in terms of initial planning since, well, arbitrary rocket and this then makes for arbitrary planets and launch positions.  As it stands, I've been pondering if what I'm looking for in terms of an initial solution is not actually a differential equation, given that so many of the subfunctions are first or second derivations of the position function.   But *shrug* I'm too busy with classes and my writing to work on it at the moment... and even if I did manage to hand-jam what appeared to be a functioning equation  (to include figuring out how to model the drag correctly as you've noticed) I have no experience modding so I'd have to learn how to code it :P

 Ideally, I'd probably call it something like "Ground Control" and let folks do basic calcs like "*CAN* it get to orbit on its own?" (Note: That's not can *I* get it to orbit.  :P), toss in a 'Can display a target pip on the Navball for where you should be pointing" and some other informational stuff for folks who want it less easy mode.... but generally speaking, this is just a far more complex version of "You have an oil rig at position (x1,y2) and your pumping station is at (x2,y2) what is the best path to place the oil pipeline to minimize the cost of construction.

Link to comment
Share on other sites

7 hours ago, Draco T stand-up guy said:

Gravity Turn lets you set m/s for when the turn starts.

It's also OpenSource so having a look at how they do it may help with your own.

I am doodling with their code but Id like to know actual way of them calculating all these forces :o

 

Link to comment
Share on other sites

16 hours ago, Snark said:

Fair 'nuff, if you like flying that way, more power to you!  :)

Just be aware that you're wasting hundreds of meters per second of dV.  Flying straight up to 10 km is really inefficient.  Of course, it's up to you how much (or whether) that's an issue for you.

After reading the 'a degree makes a difference' thread referenced above, I started doing some real gravity turns, but as many of my payloads are pretty draggy and hard to fit into a reasonable* sized fairing, I find I am often back to only a few degrees off vertical around 35km where I pull over to 45 degrees or less off the horizon.

* if the rest of the launch platform is 2.5m, I am reluctant to add the 3.5m fairing needed to encapsulate my payload, although I should probably try it at least once to see how well it would work...

Link to comment
Share on other sites

10 hours ago, storm6436 said:

 This problem is one of the reasons I decided to go for dual degrees in Applied Mathematics and Physics :wink:

 I originally started out in much the same position where your posts indicates you are... figuring out basic forces, a free body diagram, etc... but unfortunately basic kinematics isn't going to make life any simpler.  I moved on from there to the idea of using just vector calc, given that for a given arbitrary orbit one must have be in a specific position with a specific velocity vector, say V2... then your initial launch vector is V1, where vertical and along the latitude axis is zero, but you inherit the velocity from the spin of the planet.  This seemed a but more robust of a solution, at least in terms of initial planning since, well, arbitrary rocket and this then makes for arbitrary planets and launch positions.  As it stands, I've been pondering if what I'm looking for in terms of an initial solution is not actually a differential equation, given that so many of the subfunctions are first or second derivations of the position function.   But *shrug* I'm too busy with classes and my writing to work on it at the moment... and even if I did manage to hand-jam what appeared to be a functioning equation  (to include figuring out how to model the drag correctly as you've noticed) I have no experience modding so I'd have to learn how to code it :P

 Ideally, I'd probably call it something like "Ground Control" and let folks do basic calcs like "*CAN* it get to orbit on its own?" (Note: That's not can *I* get it to orbit.  :P), toss in a 'Can display a target pip on the Navball for where you should be pointing" and some other informational stuff for folks who want it less easy mode.... but generally speaking, this is just a far more complex version of "You have an oil rig at position (x1,y2) and your pumping station is at (x2,y2) what is the best path to place the oil pipeline to minimize the cost of construction.

I think the appropriate tool is calculus of variations.

You will want to work in phase space.  Then kinematics puts restrictions on your path within that space, you will a two variable control function (AoA & Throttle). If you use total dV as your Euler-Lagrange functional, then you would analytically determine what a locally optimal path in phase space looks like. You would get something like "if, are moving with this velocity vector at this altitude, you should have this angle of attack with this throttle.

Then you would have to optimize the starting point of your path to find a globally optimal path. That part would likely have to be done numerically, or in KSP through trial and error. 

 

Link to comment
Share on other sites

On 11/16/2016 at 3:17 PM, SchweinAero said:

The ideal gravity turn is just what it says on the tin: a turn made by gravity only. In that case, the rocket would smoothly fall over by itself as it ascends, requiring just a slight sideways nudge at the start and some throttle control throughout.

While that will produce "a" gravity turn, and any gravity turn will require zero navigation losses, I'm fairly certain that the optimal path into orbit doesn't depend on the moment of inertia of the rocket (which would have to be carefully designed in the VAB to match the ideal moment of inertia).  One obvious benefit to limiting yourself to such "ideal gravity turns" is that you still have a variable to account for, the initial angle of attack.  This "start the turn" can basically be done on the pad (not recommended, no means of measuring your angle in the VAB) or after launch (preferably by mechjeb.  And do so as soon after the launch as possible*).

*done IRL as well.  But presumably not fast enough to prevent Antares from blowing up the pad at Wallops (they probably start turning for safety before it would make sense to turn for efficiency reasons (which is still well before 10km)).

Link to comment
Share on other sites

Hello, all.

I was bored so I calculated optimum ascent trajectories for my typical, reuseable lifter. I compared force of drag to the rearward component of gravity at different altitudes (gravity parallel to the longitudinal axis of the rocket). Values with asterisks are speeds which I anticipate heat becoming a limiting factor. Pitch lower than these values will lose more energy to drag. Pitch higher than these values will lose more energy to gravity.

From the data you can see an aggressive gravity turn and a high TWR are favorable. Hopefully this data is somewhat useful for those of you with similar mass/diameter rockets. It should help you find the optimum "keyholes" to get your best launch. As others have said elsewhere, don't worry about fire graphics down low, it pays to turn and accelerate ASAP.

100t rocket, 2.5m diameter, Cd 0.2

Optimum Ascent Pitch, SL,
V(m/s)-pitch(degrees above horizon)
300-3.5
600-12.5
*1200-77.8
2400-vertical

Optimum Ascent Pitch, 5000
V(m/s)-pitch(degrees above horizon)
300-1.2
600-5.2
1200-21.8
*1800-54.8
2400-vertical


Optimum Ascent Pitch, 10000m,
V(m/s)-pitch(degrees above horizon)
300-horizontal
600-2.5
1200-8.7
*1800-19.8
2400-36.4

Optimum Ascent Pitch, 20000m
V(m/s)-pitch(degrees above horizon)
600-horizontal
1200-1.5
*1800-3.2
2400-5.5

Optimum Ascent Pitch, 30000m
V(m/s)-pitch(degrees above horizon)
*1800-horizontal
2400-0.7

 

Link to comment
Share on other sites

On 16.11.2016 at 4:41 PM, Snark said:

You also need to review your assumptions.  If you're waiting until 1000m to start a gravity turn, that is way too late-- especially if you're launching with a really high TWR, like 2.  You should be starting your gravity turn practically right off the pad.

This.

You'll have a pretty high vertical speed by then. The necessary gravity turn will be pretty deep to be optimal. And that puts you at a huge attack angle relative to current velocity vector, creating huge drag, wasting lots and lots of speed which you've already gained, creating stability issues, and so on.

Stability is a function of airspeed and attack angle. Even at 40m/s you're getting first kick of stabilizing forces from aero, and it only grows. An optimal gravity turn requires very low attack angle throughout most of it so the stability is not really an issue - by the time you need to deviate from prograde by any considerable amount you've got enough of airspeed to keep you stable regardless. Air drag is also a function of these two, and you'll be at a huge disadvantage if you need to turn by a large angle while moving fast.

Really, optimizing gravity turn for start at 1000m is a bit like optimizing your pole vault performance with assumption of first having sprinted for 50 meters perpendicular to the track before you turn towards the vault.

Calculate your optimization "right off the pad" and you'll find the initial bit of acceleration is nearly vertical regardless; you won't encounter the early stability problems because your airspeed will be sufficiently high before your angle could create them.

Edited by Sharpy
Link to comment
Share on other sites

On 11/16/2016 at 8:17 PM, SchweinAero said:

The ideal gravity turn is just what it says on the tin: a turn made by gravity only. In that case, the rocket would smoothly fall over by itself as it ascends, requiring just a slight sideways nudge at the start and some throttle control throughout.

No, the ideal "gravity turn" has almost nothing to do with gravity.  The force due to gravity acts through the vessel's CoM and therefore produces no rotational moment that makes it turn or "fall over by itself".  The reason the rocket turns is that you manually start burning slightly sideways which causes the direction you are travelling in to move away from vertical.  It is then the aerodynamic forces on the rocket (the big fins and generally wider structure at the bottom) that cause it to follow the prograde vector.  The more it follows the prograde vector, the more of the thrust is acting sideways and the faster the prograde vector moves away from vertical.  With a well designed rocket you can do a real "gravity turn" on Kerbin with SAS turned off and no control inputs after the initial pitchover of 5-10 degrees.  Try the same thing on a body with no atmosphere and you will just continue to climb at 80-85 degrees...

Link to comment
Share on other sites

4 minutes ago, Padishar said:

 Try the same thing on a body with no atmosphere and you will just continue to climb at 80-85 degrees...

Actually, nope - 1st law of dynamics for rotary motion; your rocket will keep spinning after the initial bump unless you stabilized it manually (and without SAS you'll never stabilize it fully so it will keep turning once you stop providing control inputs.)

Though you're correct - it's a lucky happenstance that the set of forces - gravitational drag, aerodynamic stabilization, engine thrust, result in rocket tilt mostly corresponding to optimal gravity turn - which by itself is the curve that optimizes trajectory in respect to atmospheric drag + gravity drag - so a gravity turn quite close to optimal can be performed with a rocket without user input past the initial. But for a "truly optimal" one you'll need active guidance.

 

Link to comment
Share on other sites

4 minutes ago, Sharpy said:

your rocket will keep spinning after the initial bump unless you stabilized it manually

Stabilising it manually is exactly what's usually meant by a pitchover of 5-10 degrees, you move the nose 5-10 degrees off vertical and then you leave it there.  Because you do this at a low speed, the aero forces don't return you to vertical before the sideways thrust shifts the prograde vector to match and then go beyond your heading.  As you speed up more the rocket more strongly follows prograde.

The point of my message (that I didn't really make very well) was that the "turn" in "gravity turn" is describing the curve in the trajectory, not the turning of the vessel's heading. Gravity is responsible for shifting your acceleration vector "below" the direction the nose is pointing, which causes prograde to move "down".  You need something else (aero forces or control inputs) to make your nose follow prograde or you'll keep burning in the original direction and the curve in your trajectory will be very much less...

Link to comment
Share on other sites

Deciding whether it pays to climb above atmospheric drag or accelerate horizontally to minimize gravity losses seems to be the critical choice to make in any gravity turn problem.  

Early turns and aggressive accelerations are favored.  An initial ten degree pitch over seemed to be followed by 70 (20 degrees above the horizon) by the time I am doing about 1600m/s at 10000m.  

Others have made the same point about early turns and higher TWR many times before.  It seems the numbers support this too.

Using the math I run, I am getting to LKO with about 3300dv.

Link to comment
Share on other sites

5 hours ago, Padishar said:

No, the ideal "gravity turn" has almost nothing to do with gravity.  The force due to gravity acts through the vessel's CoM and therefore produces no rotational moment that makes it turn or "fall over by itself".  The reason the rocket turns is that you manually start burning slightly sideways which causes the direction you are travelling in to move away from vertical.  It is then the aerodynamic forces on the rocket (the big fins and generally wider structure at the bottom) that cause it to follow the prograde vector.

Interesting. I stand corrected. The fact that you only ever hear of gravity turns made on Kerbin, Eve and Duna should have been a clue.

Edited by SchweinAero
spelling
Link to comment
Share on other sites

You make gravity turns in vacuum as well, like on Minmus or Mun.  Since there is no atmosphere to worry about, you don't have to worry whether it's advantageous to vector above a dense, draggy atmosphere or not.  So on Mun or Minmus, you just need to gain enough altitude to clear terrain and most of your thrust can be spent accelerating horizontally until you have a desired apoapsis.

Also, this:

 https://en.m.wikipedia.org/wiki/Gravity_turn

Also a good or bad gravity turn with an atmosphere seems to make about 15% difference in DV to orbit.  Without an atmosphere the difference between 045 degree ascent and a nearly horizontal ascent is much less.

Link to comment
Share on other sites

Spoiler
On 17.11.2016 at 5:19 AM, Draco T stand-up guy said:

Gravity Turn lets you set m/s for when the turn starts.

It's also OpenSource so having a look at how they do it may help with your own.

On 17.11.2016 at 7:33 PM, Nicias said:

I think the appropriate tool is calculus of variations.

You will want to work in phase space.  Then kinematics puts restrictions on your path within that space, you will a two variable control function (AoA & Throttle). If you use total dV as your Euler-Lagrange functional, then you would analytically determine what a locally optimal path in phase space looks like. You would get something like "if, are moving with this velocity vector at this altitude, you should have this angle of attack with this throttle.

Then you would have to optimize the starting point of your path to find a globally optimal path. That part would likely have to be done numerically, or in KSP through trial and error. 

 

On 18.11.2016 at 5:15 AM, Jonfliesgoats said:

Hello, all.

I was bored so I calculated optimum ascent trajectories for my typical, reuseable lifter. I compared force of drag to the rearward component of gravity at different altitudes (gravity parallel to the longitudinal axis of the rocket). Values with asterisks are speeds which I anticipate heat becoming a limiting factor. Pitch lower than these values will lose more energy to drag. Pitch higher than these values will lose more energy to gravity.

From the data you can see an aggressive gravity turn and a high TWR are favorable. Hopefully this data is somewhat useful for those of you with similar mass/diameter rockets. It should help you find the optimum "keyholes" to get your best launch. As others have said elsewhere, don't worry about fire graphics down low, it pays to turn and accelerate ASAP.

100t rocket, 2.5m diameter, Cd 0.2

Optimum Ascent Pitch, SL,
V(m/s)-pitch(degrees above horizon)
300-3.5
600-12.5
*1200-77.8
2400-vertical

Optimum Ascent Pitch, 5000
V(m/s)-pitch(degrees above horizon)
300-1.2
600-5.2
1200-21.8
*1800-54.8
2400-vertical


Optimum Ascent Pitch, 10000m,
V(m/s)-pitch(degrees above horizon)
300-horizontal
600-2.5
1200-8.7
*1800-19.8
2400-36.4

Optimum Ascent Pitch, 20000m
V(m/s)-pitch(degrees above horizon)
600-horizontal
1200-1.5
*1800-3.2
2400-5.5

Optimum Ascent Pitch, 30000m
V(m/s)-pitch(degrees above horizon)
*1800-horizontal
2400-0.7

 

 

Firstly;

Thank you everybody for their posts and replies for this entry.

You guys made me enjoy the game more than I did before by inspiring and guiding me.  I have led some experiments and came up with an optimum Launch Vehicle for Low Tech Career both Part, both Credit efficient ways at the same time!

Using Gravity Turn Mod is essential to make accurate gravity turns.  It is not cheating, nothing; I have never used MechJeb yet I know what it is, some people like that taste but I like to do my math

 even though Gravity Turn Mod does calculate your Angle and Starting speed, I wanted to be accurate, of course you can never be accurate but the lowest Total Burn I saw using my numbers were 2750 dV to orbit. However that approach can be deadly HOT and is not the most efficient scenario always so... I ran some excel spread sheets and foundout the most efficient gravity turn for 2 TWR is 28 degrees East right off the pad.  I gave it some aerodynamic error path as 15m/s start for turn.  With such an ascent path, you won't be worrying about passing 2400Kelvin and burning up while passing the thick part of the atmosphere.

Optimum.png

Using those values, with a rocket typically like this;

You would achieve an orbit with 2795 dV. And lift a 80 ton payload for only 15,000 funds. That is around 6 Funds per tonnes!

STEPS:

1) Have;

  • Gravity Turn Mod
  • Kerbal Engineer Mod

2) Aim for 2TWR and 3,500 dV Vacuum. (3,125 would do fine but I like a 10% safety margin)

3) Design so that 1st stage is your engine and 2nd stage is your payload.

4) Using Gravity Turn values of

  • Turn Start: "15m/s"
  • Turn Angle: "28degrees"
  • Roll: "270"
  • Apoapsis aimed 72,000m

5) As soon as reaching 30 seconds before Apoapsis, Abort Gravity Turn Mod.  By now you will be in a 72x12 orbit

6) Use only 50m/s ish for circularising.

7) Detach your engine stage and you will be left with something around 300-400 dV if you used your safety margin, and use this dV for de-orbiting.

8) If you designed your engine stage recoverable, you will be recovering 100% of your Dry devices while only paying for fuel which is only negligible.

 

Tomorrow I am hoping to post final version of my design on the front page of this post.

 

My conclusions are; higher TWR does reduce your dV required while increasing design complexity and initial price since I am assuming you can find a way to recover every piece if you are a try hard person, while playing a career game having an initial money, losing that money by without recovering, running low on deltaV because of budget or even having not enough TWR can be stressing.

For a person playing Career mode, 2TWR and 3,300 ish dV for a 1st stage part aren't dreams even in the low tech tree.  Upon all that adding a full recoverable engine and fuel fuselage design can be really awarding.  The only downside of this approach is getting to Apoapsis takes 10 minutes in x1 speed, so if you want to use your x4 speed you ll need a tight design as mine.  Or MOAR STRUTS!

Fly safer than Scott Manley and pull our Kerbal society forward to the future guys! I am sure hes out there building a god damn space elevator on Minmus by this time but mine is just  a humble approach.

Edited by Lynch
Fixing
Link to comment
Share on other sites

Gravity turn optimization is a really hard problem. Analytically, I have not seen it solved even with the old, simplified aerodynamics. To contrast this, for a vertical ascent, I was able to solve optimal TWR even under conditions of ISP and gravity varying with altitude. Once you throw in a second dimension, however, optimization becomes really hard.

Numerically, it's not quite as bad, but still a tough problem. I had pretty good success with genetic algorithm. But the best way to go about it is parameterization  of ascent profile and running a good optimization algorithm on the parameters. I have not gone to the trouble myself, but I've seen people here run the numbers for specific craft, coming up with very reasonable results.

There are also some good approximations. For example, during early ascent, you pretty much rely on constant fuel flow. Under these conditions, fuel spent is a function of time only, and rocket's speed is function of density only. So you can use optics to figure out the correct trajectory, using ratio of terminal velocity at each altitude to sea level's as your optical density. This, however, relies on you knowing the optimal angle at which you want to exit the region where this approximation is fair (up to about 10km). Which means you have to solve the rest of the problem the hard way anyhow.

Link to comment
Share on other sites

I gave up trying to solve this numerically (am an idiot in math). Since the soupmosphere was dismissed i found that aiming for a twr of 1.5 to 1.7 and a (vacuum)dv of ~3300m/s is a safe launcher concept. Manual flight, using ker, starting the "gravity turn" right of the pad or at very low speed. It does get warm.

Kerbin is a small ball for it's mass, the atmospheric gradient is smaller than the real one, and the heat production follows the smaller scale as well, making the first 40km altitude pretty shiny.

For interplanetary departures i aim higher than 75-80km, to avoid departure through the atmosphere ... :-)

 

Link to comment
Share on other sites

On 11/16/2016 at 10:23 PM, Norcalplanner said:

Looks like a good time to trot this out again...

While these are not true gravity turns, the general concept is the same. The most efficient ascent in stock at 1.57 initial TWR was under 3,100 m/s of delta v.

I should point out that since these "non gravity turns" lock onto prograde they have no steering losses (although there might be aero losses if fins are used to maintain attitude).  "True gravity turns" that can't manage to always point prograde will have losses equal to the cosine of the angle between actual attitude and prograde.

"Lock onto prograde" appears more efficient and easier to optimize (only variables are initial angle and possibly TWR).

Link to comment
Share on other sites

21 minutes ago, wumpus said:

I should point out that since these "non gravity turns" lock onto prograde they have no steering losses (although there might be aero losses if fins are used to maintain attitude).  "True gravity turns" that can't manage to always point prograde will have losses equal to the cosine of the angle between actual attitude and prograde.

Can you describe the difference between a "non gravity turn" and a "true gravity turn"?

Incidentally, @Lynch, you should update to the latest dev release of KER (see my sig) as the deltaV calculations have now been updated for the changes to fuel flow in KSP 1.2...

Edited by Padishar
Link to comment
Share on other sites

7 hours ago, Padishar said:

Can you describe the difference between a "non gravity turn" and a "true gravity turn"?

Incidentally, @Lynch, you should update to the latest dev release of KER (see my sig) as the deltaV calculations have now been updated for the changes to fuel flow in KSP 1.2...

On 8/20/2016 at 4:46 PM, Norcalplanner said:

As a reminder, this rocket is not flying a true gravity turn.  It's actively steering to remain locked on the prograde vector, first in a surface reference, then in an orbital reference.  A rocket flying a true gravity turn, depending on aero forces to turn the uncontrolled rocket after the initial controlled tilt, is going to have different results, as will a rocket without SRBs.  With those disclaimers out of the way, here are the results.

I've given up on knowing what a "true gravity turn" is.  Especially if it relies on atmospheric conditions and not gravity.  The optimal path on Mun, Minmus, or any other body without an atmosphere basically involves defining an orbit slightly higher than the highest mountain and then following the flattest elliptical path to that orbit that avoids the surface (i.e. mountains and such).  Of course, even then there is no way to do a "gravity turn" without the necessary atmosphere.

Maybe you can ask Norcalplanner, he was the one I was replying to.

Link to comment
Share on other sites

Away from the computer at the moment, but the methodology used for the turn is described in the OP of the original (RSS) version of the thread. There are some steering losses during the initial tilt, and hardly any during most of the burn, and I noticed when completing those burns that steering inputs from MJ were practically nonexistent.  The majority of the steering losses actually occurred during the circularization burn, which goes to show the value of a proper ascent with a very small final burn. In my testing, if the final burn to achieve orbit is less than 100 m/s of delta V, then it was a good ascent.

The important thing is that it was the most replicate-able method I could come up with to test my thesis regarding the impact of a single additional degree of initial tilt.

Edited by Norcalplanner
Typos
Link to comment
Share on other sites

Drag is also a function of velocity.

Not all the forces are necessarily aligned (why did you mention horizontal and vertical rocket/thrust force ?)

Also, the planet is round. You need to address that, which is TBH the hardest part of the problem, at least in KSP thanks to the tight curvature.

 

Slight off : IRL you'd also have to address diferent stage characteristics, current payload, maximum TWR, heating, and other things regarding traveled trajectory (such as location of launch vs. intended final orbit, obstacles to staging or even overflight like cities or other nations etc).

Edited by YNM
Link to comment
Share on other sites

On 11/16/2016 at 9:41 AM, Snark said:

You also need to review your assumptions.  If you're waiting until 1000m to start a gravity turn, that is way too late-- especially if you're launching with a really high TWR, like 2.  You should be starting your gravity turn practically right off the pad.

Of course, you can do the calculations based on "what if I climb to 1000m first?"... i.e. "what's the most efficient path, if I start off that way"... but it's kind of moot.  You'd be optimizing a non-optimal situation.

He's right, if you want to wait until 1000m use a twr or 1.4.

The problem you will have is that you are going to gain relative acceleration over time as fuel bleeds off. If you hold thrust then your velocity will resist turning.

Turning is much easier at a lower velocity. If you wait until you have a high velocity to turn then what happens is that your side-drag becomes lift.

 

 

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