Jump to content

Mini-challenge: max altitude with this supplied spacecraft


Recommended Posts

There has been some discussion about thrust/velocity profiles for fuel-efficient ascent, so here\'s a way to test your own strategy. In fact this is known as the 'Goddard problem' in control theory and there are papers on it, but nowhere near so much fun as testing it yourself.

This is also a 'fuel efficiency' challenge, but will take you less than 5 minutes\' flight time. We are launching the supplied sounding rocket into the upper atmosphere (.craft file attached). No modifications allowed, no .cfg edits. The challenge is simply to reach the highest altitude with the spacecraft supplied.

A bunch of these were found lying around the junkyard, and were being used for upper-atmosphere research. The ASAS module is payload, you can keep it turned off if you want. And yes, I know we can get higher with 1 tank+LFE, but I chose this design to give us a large range of possible thrust/weight ratios, and so that we would not have to wait a long time for the 'coast' phase of the flight to apokerb. If you can think of a better challenge craft for everyone, please let us know, but have a go with this one first.

Proof of claimed altitude required:

- screenshot of your spacecraft close to max. altitude (to prove it is the one supplied, with no modifications)

- screenshot of the end-of-flight results, clearly showing no prior stages, the maximum altitude, AND your impact velocity when it hits (sorry Kerbals). If you cheated by reducing any drag factors in the .cfg files, your impact velocity will be higher than ~110 m/s, which will give the game away.

- Optionally, a video of your flight if you used some clever speed vs. altitude profile. Otherwise a few words of explanation.

My first attempts: If I blindly floor it at 100% throttle, I (and you) will reach about 22000m. Using careful thrust management (including the 'X' key briefly) I managed 33289m.

3522gig.png

28i70w3.jpg

If you can get above 33500m without cheating, please tell us all how!

Leader board:

1st* DayBlur 33632 m - *using autopilot plugin code to control throttle.

1st DayBlur 33560 m 2nd antbin: 33549 m 3rd Kosmo-not : 33519 m

4th nichampagne 33514 m 5th jebbe: 33495m 6th closette: 33490 m

7th PakledHostage 33487.5 m 8th boolybooly: 33479 m

Link to comment
Share on other sites

I\'ve gotten a max altitude of 33,405. I don\'t believe the final velocity would be a good measure of whether someone has done the job honestly, as not impacting capsule first can slow you down a bit. For instance, I had a final velocity of 64.1 due to this. Mission time would be a better indication. Somewhere near 4:30.

Link to comment
Share on other sites

I somehow knew you\'d beat me! Well, mission time is on the screenshot too, but I didn\'t expect that changing the orientation would change the impact speed so much. Perhaps something to do with angularDrag in the .cfg settings gets used in the calculation.

I think you\'re pretty much close to optimal, but someone out there might be able to gain a few more meters? Thank you for giving it a go!

Link to comment
Share on other sites

I somehow knew you\'d beat me! Well, mission time is on the screenshot too, but I didn\'t expect that changing the orientation would change the impact speed so much. Perhaps something to do with angularDrag in the .cfg settings gets used in the calculation.

Stock capsule has 33% more drag when falling sideways.

Link to comment
Share on other sites

(Just replied on the other thread, but thanks for taking a look at this one).

Stock capsule has 33% more drag when falling sideways.

Is that an experimental result, or is there a formula based on the .cfg settings that one can use to figure out orientation effects on drag?

Oh by the way: 33418m

3134n88.png

w9ipab.png

Link to comment
Share on other sites

By trial-and-error, but with the general shape of the solutions to Goddards problem somwhere in the back of my head: 33,480m.

edit: I should probably mention that I used time warp. In other scenarios it\'s obvious that the solver gives different results for different time stepping (which time warp seems to imply), so I\'m guessing that this might influence the final height somehow.

screenshot8.pngscreenshot0.png

Has anyone tried to actually calculate the speed at which the singularity in thrust occurs, and the optimal setting afterwards?

Link to comment
Share on other sites

@jebbe,

Great job with the challenge - I doubt I could even get close to that altitude! Clever use of time warp is not forbidden, therefore allowed (it\'s not clear whether it will help).

I\'ve seen the term 'singularity' used before for this problem, but could you please explain what it means in this context?

And if you are able to derive the theoretical solution, which nobody has done AFAIK, please message me and I\'ll send you all the details I have. This should be a much easier problem to optimize than in real life, and I\'d really like to know!

(Also, due to KSP\'s funky drag model, the optimal ascent profile should pretty much apply to any launch vehicle up to staging).

Link to comment
Share on other sites

@Kosmo-not,

Wow, another 40m - how many attempts did that take you? I think I have to forfeit this and bow my head. :)

Do you use the 'x' key after the initial full throttle burn? I found that it was a little more efficient to just throttle down using 'ctrl'.

@closette,

Singularity is probably not the right term, I think I should rather just call it discontinuity. I mean the point after initial full throttle ascent, when you suddenly drop the thrust.

About the theoretical solution: While I do have a background in physics and numerics of PDEs, I don\'t know much about control theory, and it would probably take me quite some time to solve this problem by myself. For the actual challenge I just googled 'Goddard\'s problem' and quickly looked at a couple of papers. All of them have this one graph of optimal thrust over time, and they always look roughly the same, so I just tried to go for something like that in the challenge.

edit: typo

Link to comment
Share on other sites

Yep, Kosmo-not has probably shut down the competition here! Unless....

Jebbe, could you post one of those curves - I too looked at a few Goddard problem papers and did not extract anything useful from them.

I can 'reveal' my strategy that at least got close to Kosmo-not\'s record: Max thrust to get up to terminal speed (~ 100 m/s), followed by a rapid drop in thrust such that the rocket followed something close to (never below, but sometimes a bit above):

v(height) = 100 Exp(height/9900m).

which I had evaluated every 1000m in an open Excel window next to the KSP window. As long as the acceleration is less than g, this profile translates into a thrust/weight ratio of just above 2.0.

It was easy to follow this profile up to about 12000m, in fact for 3000m to about 10000m there was a 'sweet spot' in the throttle position when the craft would naturally hit the right velocities. Above 10000m this function begins to take off rapidly, so I winged it, but made sure that I 'finished with a flourish' at full throttle when the fuel ran out.

I think the small differences we\'re getting in max altitude can be traced back to how well we throttled back in the first few seconds. I would be surprised if the optimal solution was a real discontinuity though, since all the other forces are continuous.

OK Kosmo-not, what did you do to get the record and shut out the competition?

Link to comment
Share on other sites

My flight plan went as follows:

Max throttle at launch (who wouldn\'t?)

throttle down at around 100m/s

maintain TWR at around 2

increase TWR gradually after passing 6km I think

I\'m going to fiddle with excel to see what it can do.

Link to comment
Share on other sites

@Kosmo: Cool - message me if you need any assistance. I presume you kept TWR=2 by using a similar velocity scheme as me? (Since there is no 'thrust indicator' or 'weight indicator' for that matter).

@jebbe - sorry, I just crept past you into 2nd place at 33490m, and that\'s about as good as I can get. It seems that the closer I follow my speed vs. height scheme, the higher I can reach, so it\'s down to my imperfect hand-eye coordination in the first and last few seconds.

eg32fm.png

70ezw8.png

Link to comment
Share on other sites

From what I found, the actual solution is really discontinuous, which in my understanding comes from the fact that we artificially set a maximum for the thrust. Without this constraint I would expect a singularity at v=0; since we don\'t allow for that, the system responds with the discontinuity.

An numerical solution to the problem is shown e.g. here, http://cas.ensmp.fr/~petit/papers/ifac2008/0637.pdf, fifth page (14305), Fig. 2, (black lines are the actual solution).

They use an exponentially decaying atmospheric drag, but I don\'t think this is responsible for the discontinuity.

Your strategy to keep the TWR constant seems to contradict this figure, but the increase in thrust in the paper is probably due to the atmosphere. In my first attempts I increased the throttle quite a bit later in the ascent, but for my best result I kept it almost constant. Still, I\'m not sure if keeping the TWR constant is a good idea, since that would mean throttling down, which I saw in none of the figures so far. Anyway, I think what we definitely need to do is power up as soon as we reach the second atmospheric layer at around 13km.

edit: Added some thoughts on the discontinuity

Link to comment
Share on other sites

There are a few properties about the physics of this game that make the problem much easier to solve in this scenario:

-Gravity is a conservative force, meaning that in the absence of drag, moving from point A to B takes the same amount of energy, regardless of the path or speed.

- Fluid dynamics is a huge discipline that is practically, but not fully, understood. For the purposes of the game, the drag force is going to be proportional to either velocity or velocity squared.

-Drag force is also dependent on fluid density. Fluid density can easily be modeled as a function of altitude in this game.

-As the rocket uses fuel, it\'s mass decreases, meaning less thrust is needed to accelerate it at a constant rate.

Using these facts, goddard\'s problem for KSP can be solved knowing:

-A function describing the change in fluid density as altitude increases

-What power of V drag force is proportional to.

-The mass, fuel consumption rate, and drag coefficient of a rocket

The goal here isn\'t to find the maximum altitude, but to find an optimal function for fuel consumption rate, using a given altitude.

Link to comment
Share on other sites

Density:

density = 0.0098*exp(-altitude/5000)

it\'s not perfect, but it\'s pretty close

Drag force is proportional to v2

FD = .5*density*CD*m*v2

drag coefficient is 0.2 for most stock parts

Mass consumption rate:

200 thrust LFE: mass rate = 2.2/(500/(8*thrust*n/(200)))

n = number of engines

I\'ve heard that the optimal velocity to be climbing at is one which the drag force equals the weight of the rocket.

Link to comment
Share on other sites

Some excellent knowledge in this challenge thread!

@jebbe - I see the reason for discontinuous thrust vs. time now, thanks.

@thosesneakyfrench,

First, welcome! Second, I agree that this is a simpler Goddard problem than real life. I personally don\'t have the skills to solve it. The info you need is in Kosmo-not\'s post below yours. If you can do it - great! (I\'d love to know what the theoretical maximum altitude for this spacecraft is, and the thrust profile that produces it).

@Kosmo-not,

The T/W=2.0 criterion is an instantaneous maximum in efficiency for small accelerations (<<g), as you showed in an earlier thread. It is obtained exactly when the drag force = weight and a=0, i.e. the craft is moving upwards at exactly the local terminal speed.

But keeping the acceleration in Newton\'s 2nd law, ma= T - W -bv2, the max. efficiency is actually for T/W = 2 +2(a/g). Below ~10km you can get away with neglecting the acceleration term, but above that altitude it will start to dominate.

Edit: In fact since instantaneous optimum thrust T = W(2+2a/g) by this equation, this might explain why you can get away with constant thrust for a while (~3000-9000m for me) at the 'sweet spot' throttle setting, since over time as weight W decreases, acceleration a increases, and for a while they nearly cancel each other\'s effects out in this equation for required thrust T.

Unfortunately this extra term ties the instantaneous acceleration to the cumulative history of what the rocket did up to that moment, which made a big mess when I tried to solve for v(t) or v(y). The weight is history-dependent also.

You might be able to include this term via iteration, however, since once you have v(y) you can compute a=dv/dt = v dv/dy.

Link to comment
Share on other sites

Here. Have a copy of my spreadsheet. Maybe you can come to some interesting conclusions. Be aware that the thrust column has different formulas in certain areas until I can find a better way of doing it.

I should create a program to calculate this stuff, but it\'s been so long since I\'ve programmed anything.

I added another line to the chart to show how the TWR changes with altitude (read from the left vertical scale).

Link to comment
Share on other sites

Ever the sceptic, I dusted off my old 'off the pad acceleration' spreadsheet and did my own test. I had tried this once before but I\'d failed to get a good fit so I gave up. Now that I know that drag in the game is a function of mass (mass??!!!? okay whatever... [flicks the radioactive cockroach away in disgust]) as well as velocity and drag coefficient, I was able to get quite a good fit. I\'m posting my test results here so that they can be reviewed and given whatever credibility (or lack thereof) that they deserve:

I launched the spacraft shown in the image below at 100% throttle, with the SAS turned on.

2eMbk.jpg

I let it climb until it reached apoapsis and then fell back to Kerbin. I recorded altitude and velocity at roughly 10 second intervals. I also set up an Excel spreadsheet to integrate the accelerations, computing the drag, velocity, acceleration and altitude at each 0.025 second time step. As above, drag was computed as a function of Cd, velocity squared and mass.

By my figures:

Cd for the stack shown above is 1.1

Initial mass is 7.4 tonnes

Thrust is 200 kN

I then adjusted the 'density scaling parameter' so that my predictions matched my data. Here\'s a plot showing the resulting altitude vs. time:

juexv.jpg

And here\'s a plot showing the resulting velocity vs. time:

P0EYh.jpg

The density scaling parameter that resulted in the best fit was 0.0017. This differs quite a bit from the 0.0098 quoted above. Maybe the difference can be accounted for in our differing methods, Kosmo-not?

I\'d be interested to see anyone else\'s results. Maybe together we can nail down Kerbin\'s atmospheric properties. The results will be useful for more than just this challenge.

PH.

PS. I tried to include my spreadsheet as an attachment to this post so that others could play with it but I got a message from the server that it was too big...

Link to comment
Share on other sites

@PakledHostage,

I love DATA! So glad you could share the graphs from your tests, which were similar to Kosmo-not\'s drop test found here http://kerbalspaceprogram.com/forum/index.php?topic=5813.msg86098#msg86098 with analysis below.

Partly based on these, and other tests, the most detailed discussion of the atmosphere, complete with density profile, scale height, composition(!), and the drag force law can be found here: http://kerbalspaceprogram.com/forum/index.php?topic=5623.0

From the same data I found a similar density law ~ 0.01 kg/m3 exp(-height/5000 m), assuming that:

- command pod mass = 1 kg (silly I know - I would guess 1000 kg but this makes comparisons easier).

- the drag force is FD = 1/2 maximum_drag x mass x density x v2 (note the factor of 1/2 which is by convention)

The unrealistic presence of the mass term was confirmed in the second linked thread above (by Kosmo-not yet again!). He found that for an assembled ship, the total drag force is just the sum of the individual FD\'s of the parts, so the conventional 'drag coefficient x area' cDA in the conventional equation FD = 1/2 cD A x density x v2 would be given by:

(maximum_drag1 x mass1 + maximum_drag2 x mass2 + ...)

which for your rocket could easily be a number close to 1.1.

Hope this helps.

(edited to include the area term A).

Link to comment
Share on other sites

I think PakledHostage is using the conventional/terrestrial definition of cDA which is basically 2*FD/ (density x v2), so includes KSP\'s mass term. But I could be wrong...anyway your numbers check out with mine.

I\'ll take a look at your TWR spreadsheet tomorrow, thanks for sharing it.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...