Community > Forum > Technology & Science > Aerobraking and reentry

Aerobraking and reentry

Posted by: campbelp2002 - Fri Oct 28, 2005 6:08 pm
Post new topic Reply to topic
 [ 85 posts ] 
Go to page Previous  1, 2, 3, 4, 5, 6  Next
Aerobraking and reentry 
Author Message
Moon Mission Member
Moon Mission Member
avatar
Joined: Tue Feb 10, 2004 2:56 am
Posts: 1104
Location: Georgia Tech, Atlanta, GA
Post    Posted on: Sun Dec 11, 2005 7:06 pm
The more complex the algorithm, the more time it takes. The algorithms that Peter is using are nearly instantaneous, and the fact that he's using a spreadsheet means he uses an interpretive language, allowing him to change variable values on the fly. A more complex algorithm, coded in something like C++, would take longer and would require a new program for every iteration of the problem (not to mention the problems if you screw up the coding). That takes more time and effort than anybody is willing to put in: Excel spreadsheets are simple, quick, and although not the most efficient solution (Assembly is the *only* way to go for efficiency, but it's hell on usability), its user-friendliness, ability to quickly change any input variable, and to fix any problem with almost no effort make it likely the best solution for almost any Quick & Dirty simulation.

_________________
American Institute of Aeronautics and Astronautics
Daniel Guggenheim School of Aerospace Engineering

In Memoriam...
Apollo I - Soyuz I - Soyuz XI - STS-51L - STS-107


Back to top
Profile
Space Station Member
Space Station Member
User avatar
Joined: Wed Nov 10, 2004 6:12 am
Posts: 321
Location: Melbourne, Australia
Post    Posted on: Mon Dec 12, 2005 2:55 am
For a programming language that has widespread availability, try writing an Excel macro in Visual Basic for Applications. You can do all the complicated stuff in a reasonably well structured language, and just leave the I/O in the worksheet. Fill in a few input parameters, hit a button to start the macro, which populates the rest of the worksheet with the results. :D


Back to top
Profile
Space Station Member
Space Station Member
avatar
Joined: Tue Dec 07, 2004 6:50 am
Posts: 265
Location: UK
Post    Posted on: Mon Dec 12, 2005 6:44 am
Spacecowboy, I think the only real point of agreement we have here (assuming this is what you meant) is that more complex algorithms usually take longer to write and that coding time is often dominant. This says little about the runtime of more complex algorithms.

You can write quick and dirty sims in a wide variety of languages, importantly the native facilities of some languages are inherently more helpful and the tools you or others can create in them can take away a lot of the dirt. Unless you spend little time doing such things, I suggest people will use their time best by using and writing appropriate tools, which for practically any kind of simulation is not going to involve a spreadsheet. The ability to change variables on the fly is not the sole preserve of spreadsheets (or even interpreted languages). Compilation time of simple programs is often of the order of a second, though admittedly that's often longer than the runtime.

Your assertion that only quick and dirty simulations are appropriate for rapid simulation on PC's, and that nobody would use more effort to do better in C++ is simply incorrect. There are an enormous number of things that could run in real-time or better, which could not be sanely attempted within the native facilities of a spreadsheet. Modest code re-use can profoundly change the difficulty of quickly doing modest simulations.

Assemblers use beyond that of specialists is not often an efficient use of time, it could now even be considered a language of last resort. Compilers have seen genuine improvement, and computer architecture has changed sufficiently that compilers can more easily expose their power. Algorithmic, cache and thread related optimizations are now (and will for the most part remain)the primary focus for performance improvement.

Prior use of assembler (or alternatively examination of compiler output) is obviously useful in profiling code and can provide insight into what is actually happening, giving impetus to change it. In general writing entire programs in assembler is something you should only ever do for the experience and going beyond use of inline assembler in production code can be considered harmful.

WannableSpaceCadet, using the spreadsheet purely for IO makes absolute sense - unfortunately I'm using Gnumeric where this option seems to be starkly absent :(


Back to top
Profile
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Oct 05, 2004 5:38 pm
Posts: 1361
Location: Austin, Texas
Post    Posted on: Mon Dec 12, 2005 5:23 pm
Actually I have been pretty happy with Excel. At first I thought it was a bad fit for the problem, but it is growing on me. It is nice to see all the positions, velocities and accelerations laid out second by second, line by line. These really are simple calculations and they do not even begin to tax the power of the computer. I didn't even know it was a general numerical method of solving differential equations, I just made it up on my own way back when to simulate gravity. I figured that if a rock in space knows where to go just based on lots of point gravity sources all over the place, and I am smarter than a rock, that I should be able to figure out where it should go by just calculating all the accelerations from all the gravity sources, adding them up and applying the one resulting acceleration vector to the current velocity. Move the rock in a straight line at that new velocity for some very short time and calculate all the accelerations again at the new location. Repeat as needed. So simple. Later, when googling for information for that other thread I discovered that what I was really doing was Euler's method.

Since then I have been looking at the more accurate Runge-Kutta method:
http://www.library.cornell.edu/nr/bookcpdf/c16-1.pdf
As far as I can tell it should not add much complexity or impose much extra load on the CPU, but I am having trouble understanding it. The beauty of the way I have been doing it is that anybody (well, almost anybody) can easily understand it. That is the real reason I use it, not to reduce load on the computer. After all, that is what computers are for. Doing all those calculations you don't have time to do yourself.


Back to top
Profile WWW
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Jul 15, 2003 8:46 pm
Posts: 1215
Location: Kapellen, Antwerp, Belgium, Europe, Planet Earth, the Milky Way Galaxy
Post    Posted on: Mon Dec 12, 2005 5:44 pm
This "should, haven't tested it" work as Runge Kutta (4) for 2D, also known as rk4:

1st Differential
F = V + g
a = F/m
k1 = a * dt

2nd Differential
F = V + (k1/2) +g
a = F/m
k2 = a * dt

3rd Differential
F = V + (k2/2) +g
a = F/m
k3 = a * dt

4th Differntial
F = V + k3 + g
a = F/m
k4 = a * dt

Vnew = V + (k1 + 2*k2 + 2*k3 + k4)/6
Snew = S + Vnew * dt

It should loop, and use output back as input.


Where as example: g = -9.81 m/s* (* = to the second, but ² seems to create only a strange string ;)) this may need to change depending on distance from earth (or mars, moon, etc :p)

dt is delta time
m is mass in Kg
v is Velocity m/s
s is distance meter
a is Acceleration m/s* (* = to the second, I really need to fix that forum bug :P )

You can use the same for angular acceleration.
:roll: I hope I didn't wrote some mistakes, so some fact checking may be needed, but in general it's right (that atleast I can guarentee) :P

_________________
Heavier-than-air flying machines are impossible. - Lord Kelvin, 1892


Back to top
Profile WWW
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Oct 05, 2004 5:38 pm
Posts: 1361
Location: Austin, Texas
Post    Posted on: Mon Dec 12, 2005 6:42 pm
8) Awesome Sigurd! Where did you get that?


Back to top
Profile WWW
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Jul 15, 2003 8:46 pm
Posts: 1215
Location: Kapellen, Antwerp, Belgium, Europe, Planet Earth, the Milky Way Galaxy
Post    Posted on: Mon Dec 12, 2005 7:00 pm
campbelp2002 wrote:
8) Awesome Sigurd! Where did you get that?


I've been playing with it before with code.. I'm a game programmer :P
It should make it a lot more accurate compared to eular, but it's not "perfect". In games we don't care, as long it's looking and feeling "right". But for rockets... it's sometimes better to write per flight detailed step by step math. Only it's not as fun as this one.. this is a lot easier (but each step, you lose some accuracy).

I haven't looked at your other formula's (havn't been reading the whole topic), but maybe you should add the rotation of the rocket etc, related to the Velocity, distance to sea level, gravity, Air Dencity, it may all change the numbers a little :)

_________________
Heavier-than-air flying machines are impossible. - Lord Kelvin, 1892


Back to top
Profile WWW
Space Station Member
Space Station Member
avatar
Joined: Tue Dec 07, 2004 6:50 am
Posts: 265
Location: UK
Post    Posted on: Mon Dec 12, 2005 7:17 pm
Sigurd, this isn't right - you are adding velocity to accelerations for no apparent reason and not treating position correctly.

Moreover, it is important when learning about the algorithm to put distance between the algorithm and what is being integrated. Velocities and positions being seen equally by the integration method, with no special provisions. They are simply quantities which have a derivative and are being integrated with respect to xn.
e.g. in RK2 the procedure receives a state vector for which a derivative vector is computed. From these two a new state (the estimated midpoint) vector is made and using the derivative of that vector and the original state, the new state vector for xn+h.

RK4 is very similar but with more intermediate steps.


Back to top
Profile
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Jul 15, 2003 8:46 pm
Posts: 1215
Location: Kapellen, Antwerp, Belgium, Europe, Planet Earth, the Milky Way Galaxy
Post    Posted on: Mon Dec 12, 2005 7:29 pm
@nihiladrem, I copied it from a project in my research dir on my hard disk I played with relative long ago.. I'm wondering if I just made it look nice (and didn't made it as reality, since I don't know the physics law out of my head some things need to be right, since I must have used some example or code to copy/learn from) I'm not an expert at it.. I only let it look good.. but in this case I guess someone who knows the laws of physics needs to correct me, cuase I can't say for sure what the right things are...

_________________
Heavier-than-air flying machines are impossible. - Lord Kelvin, 1892


Back to top
Profile WWW
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Jul 15, 2003 8:46 pm
Posts: 1215
Location: Kapellen, Antwerp, Belgium, Europe, Planet Earth, the Milky Way Galaxy
Post    Posted on: Mon Dec 12, 2005 7:46 pm
What that code does:

Quote:
F = V + g
a = F/m
k1 = a * dt


Let Velocity start at 1000 as example, Gravity will lower that number.
Acceleration is computed from the force diveded by mass, acceleration is added relative to how much time has elapsed.

I think the example of the RK4 is right.. but my formula is more simple to make something funny looking like physics, but not really right... even in my game.. I've never tried to make real life physics.. :? I better shut up and say nothing lol, before I have to learn all real physics :roll:

_________________
Heavier-than-air flying machines are impossible. - Lord Kelvin, 1892


Back to top
Profile WWW
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Oct 05, 2004 5:38 pm
Posts: 1361
Location: Austin, Texas
Post    Posted on: Mon Dec 12, 2005 8:16 pm
nihiladrem wrote:
Sigurd, this isn't right - you are adding velocity to accelerations for no apparent reason
It looks right to me, from a physics point of view. The simple formula used in physics for constant acceleration is:
newVelocity = oldVelocity + Acceleration * Time. We are just assuming T is one unit, so V=V+A.


Back to top
Profile WWW
Space Station Member
Space Station Member
avatar
Joined: Tue Dec 07, 2004 6:50 am
Posts: 265
Location: UK
Post    Posted on: Mon Dec 12, 2005 8:20 pm
The problem starts on the first line, why is there a forwards force exactly equal to velocity in the direction of motion? (because it is a rocket?)
I've no problem that Sigurds code does something, but I'm really not sure what relation is has to RK4.
What's worse is that there is no statute of limitations on incorrect fourth order Runge-Kutta :)


Back to top
Profile
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Oct 05, 2004 5:38 pm
Posts: 1361
Location: Austin, Texas
Post    Posted on: Mon Dec 12, 2005 8:35 pm
OK, I have to agree that that looks weird. It should be V=V+g or something like that. I haven't really had time to consider it yet.


Back to top
Profile WWW
Moon Mission Member
Moon Mission Member
User avatar
Joined: Tue Jul 15, 2003 8:46 pm
Posts: 1215
Location: Kapellen, Antwerp, Belgium, Europe, Planet Earth, the Milky Way Galaxy
Post    Posted on: Mon Dec 12, 2005 8:40 pm
nihiladrem wrote:
The problem starts on the first line, why is there a forwards force exactly equal to velocity in the direction of motion? (because it is a rocket?)

It's just a rocket, stone, or comet, just a "mass" going up and back down, with velocity counting down, thanks to the gravity...
Also there is no direction.. there is only 1 axis.. I don't know what else you're suggesting that "should" be there etc.. I don't think you want to build a real rocket using that math.. but what do you have in mind as a real example of RK4 ?

_________________
Heavier-than-air flying machines are impossible. - Lord Kelvin, 1892


Back to top
Profile WWW
Space Station Member
Space Station Member
avatar
Joined: Tue Dec 07, 2004 6:50 am
Posts: 265
Location: UK
Post    Posted on: Mon Dec 12, 2005 8:45 pm
Actually I was assuming that you would be doing 3d position and velocity, I'm working on an explanation of that at the mo. It will take some more time.
For just parabolic flights anything beyond a second order method should see no changes, 2nd order methods already reconstruct these perfectly.


Back to top
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 85 posts ] 
Go to page Previous  1, 2, 3, 4, 5, 6  Next
 

Who is online 

Users browsing this forum: No registered users and 16 guests


cron
© 2014 The International Space Fellowship, developed by Gabitasoft Interactive. All Rights Reserved.  Privacy Policy | Terms of Use