Jump to content

Calculating Semi Major Axis by Hand


Sippitous

Recommended Posts

I'm working on an excel spreadsheet that will calculate dV requirements for traveling to and from different planets and am sort of stuck on determining the Semi major axis of a planet or moons orbit. I want to be able to calculate it based on the information giving in the game and no more. That includes not using time warp to find the AP and PE. That little info box on the map screen that shows the EQ radius, Area, Mass, GM, etc., and the planet/moon's current velocity and current distance about it's orbiting body is all I get. I would also allow a re-measure of the velocity and distance at a relatively short time later (like an hour or a day later) if there is a way to use triangulation or something to help figure out the ellipse SMA or orbital period. Every source I've found to calculate SMA uses the orbital period to help determine it, but I don't know how to calculate the orbital period of an ellipse based on the limited information available to me (listed above). Correction, I may have found the answer, but calculus language can easily get lost on me. Like derivatives. I don't understand them at all. So, when I read a description of an equation that contains a derivative, I have no idea if the equation will help me or not. but if i need to use a derative to solve, I will learn, but I need to know if it will in fact help.

To help clarify why I am doing this. I would like to play KSP with one of the different planets mods (don't know which yet) and also the research body mod and be able to calculate the size of the rocket that I need to travel there with out any external help.

I hope that made sense to someone who can help.

Thank you.

Link to comment
Share on other sites

That looks like it might be the answer! I've seen the vis-viva equation mentioned in a ton of websites, but somehow I missed it. Now I just need to get that "a" to the other side of the equation and all alone...I don't know how easy that will be, but I can certainly try. It's been about 10 years since I've done anything like that. 

Thank you for your help. 

Link to comment
Share on other sites

2 hours ago, Sippitous said:

That looks like it might be the answer! I've seen the vis-viva equation mentioned in a ton of websites, but somehow I missed it. Now I just need to get that "a" to the other side of the equation and all alone...I don't know how easy that will be, but I can certainly try. It's been about 10 years since I've done anything like that. 

Thank you for your help. 

It's not that hard, even though the equation may look a bit complex, you can reverse it using basic equation solving. Here's how you do it, starting from:

v2 = GM * (2/r - 1/a)

Move the GM to the LHS by dividing both sides by GM:

v2/GM = 2/r - 1/a

Move the 2/r to the LHS by subtracting 2/r on both sides:

v2/GM - 2/r = -1/a

Multiply both sides by -1 to get a positive RHS:

- v2/GM + 2/r = 1/a

Finally, take the inverse on both sides:

1 / (2/r - v2/GM) = a

Which is exactly the equation liked above by @OhioBob.

Link to comment
Share on other sites

To figure out some orbital goodies you'll also need the eccentricity. Eccentricity's a bit funkier to figure out from a position+velocity perspective, but there's a way!

 

Instructions
To find eccentricity we need one more piece of information, the speed our planet is going away from the sun. To get it, we can use the fact that speed is a change in distance over a change in time. Simply grab the altitude at two times (perhaps an hour apart) and follow equation 1 to get your speed going away from the sun. Then in equation 2, some trigonometry will get us our speed going around the sun. Finally that monster equation 3 will correlate it all to eccentricity.
 

Equations
1. vr= (altitude2 - altitude1)/(time2 - time1)      Make sure to use meters and seconds!
2. vθ = sqrt(v2-vr2)
3. e = sqrt[ (r*
vθ*vr /GM)2 + (r*vθ2 /GM - 1)2 ]

Terms
r = radius (altitude) from the sun
v = velocity of our planet
vr = speed going away from the sun
vθ = speed going around the sun
M = mass of the sun
G = the gravitational constant

 

Best of luck! If you want further reading into why this works (it's pretty surprising) you can find further reading in this post: Orbital calculations for those tired of going 'round in circles

Finally, I'm generally happy to help people get started in mathematic endeavors, so let me know if you need further help! I'm on KSP hiatus at the moment as I fix my house and teach a friend to program, but I keep an eye out for mentions and quotes, so please flag me with one of those if you'd like.

EDIT
... Apparently you can get orbital period without eccentricity. Never mind! Link

Edited by Cunjo Carl
Link to comment
Share on other sites

10 minutes ago, Pand5461 said:

IDK if that's cheating or not but: you can read SMAs from the configs in planetpack folder. For OPM, it's GameData/OPM/KopernicusConfigs. There's a .cfg for each new celestial that contains its orbital elements in the "Orbit" field.

Definitely cheating in this one instance of rules I have made for myself. Any other time, I would dive right in and grab any info I could.

Link to comment
Share on other sites

It's a slightly odd selection of information that the game is giving you. If you were observing the planet with a telescope the period is going to be one of the easiest things to measure, much simpler than the velocity or distance.

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