Jump to content

How do I find the duration of a year?


Recommended Posts

I'm facing a very unusual problem: I can't find how to determine the duration of a year on a planet.

The game give me a window of information on the planet

lL673MO.png

and that contains a lot of informations, almost all of them useless. but it does not tell me the time of revolution of the planet.

this has never been a problem before, because i used to play with the stock system, or the outer planet mod, or the real solar system, and in all those cases you can find the year lenght by a quick internet search. here i'm using another mod, i would like to know how long is a year on certain planets for the purpose of planning orbits, and I can't find this information.

I suppose, worst case scenario, I could alt-f12 a ship on a similar orbit, and this would give me at least an approximate result. I was hoping there would be a better way.

Link to comment
Share on other sites

On 7/13/2023 at 6:51 PM, king of nowhere said:

I'm facing a very unusual problem: I can't find how to determine the duration of a year on a planet.

[...]

here i'm using another mod, i would like to know how long is a year on certain planets for the purpose of planning orbits, and I can't find this information.

[...]

I was hoping there would be a better way.

Not to cause an argument, but if @jimmymcgoochie's suggestion holds, then I didn't see a local year readout anywhere in Kerbal Engineer.  It might be in later versions, though.

To your problem, @king of nowhere:

It's Kepler to the rescue!

Actually, that's not quite true; KSP does give you some information that Kepler didn't have.  However, it's largely the same problem, so we'll solve it the same way:  with (simulated) telescopes and a lot of (not simulated) maths.

If you don't mind a bit of calculation, then here's how to derive the answer from the information at hand:

First, you won't need the parameters window for the planet.  You will need it for the sun.  If your mod changes the sun, then you'll want to find the number labelled GM.  For the stock sun, it has a value of 1.172 x 1018 m3/s2.  You can find more precise values in the game files, but this works with what you can get from the Tracking Station.  (Also, if you want to figure orbits for a moon, then you'd want to get its planet's GM, instead.)

Second, you'll need the altitude and velocity values for your planet.  You can get these simply by putting the camera focus on the planet and zooming out until you can see its orbit about the sun.  For an example's sake, let's use Dres at time Y1, D01, 00:02:52:

velocity = 4,629.8 m/s
altitude = 46,499,448,126 m

Note that you will also need to add the radius of the sun, since KSP gives the altitude over the surface and we're using a formula that depends on distance from the centre.  The radius is the first value in the parameter window, so it's just as easy to find as GM.  For the stock sun, the radius is 261,600 km, which is easy enough to convert to 261,600,000 m.  Putting it together:

focal distance = altitude + radius of sun
focal distance = 46,499,448,126 m + 261,600,000 m
focal distance = 46,761,048,126 m

If your planet has a particularly eccentric orbit, then these values can change quickly.  You may be better off using Map View, where you can more easily pause the game, to obtain these values.

Next, we need to use the vis-viva equation.  Here it is:

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

where:

v = the velocity, which we found
GM = the gravitational parameter, which we found
r = the altitude, which we found
a = the semi-major axis of the orbit, which we need

As it is, this equation doesn't help us much.  We need to solve for a:

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

With the numbers:

a = (1.172 x 1018) / ([2 * (1.172 x 1018) / (46,761,048,126)] - [(4,629.8)2])
a = 1.172 x 1018 / ([2.344 x 1018 / 46,761,048,126] - [21,435,048])
a = 1.172 x 1018 / (50,127,191 - 21,435,048)
a= 1.172 x 1018 / 28,692,143
a = 40,847,419,449 m, though given the precision of GM, we can only commit to 4.085 x 1010 m.

If that's too tedious, especially if you have multiple planets, then I'd recommend a decent calculator, such as the ones at Wolfram Alpha or Desmos.  

Once you have a, it's a fairly straightforward matter to get the orbital period:

T = 2π √(a3 / GM), where the only new and unknown value is T, which is the orbital period--or local year, in this case.  Substituting our value for a yields:

T = 2π √([40,847,419,449]3 / [1.172 x 1018])
T = 6.283185 * √([6.815439627 x 1031] / [1.172 x 1018])
T = 6.283185 * √(5.8152215 x 1013)
T = 6.283185 * 7,625760
T = 47,914,063 s, which in Kerbin days is 2218.2 days.  This is off by just a little less than 1 day (which, at .04% error, is better than good for a single observation) and is mostly due to the rounding error, which results from the mere four-place accuracy that we get from the sun's GM.

If your mod uses the stock sun, then I can give you a better GM and radius:  the most accurate value for GM is 1.1723328 x 1018 m3/s2, and the best value for radius is 261,600,000 m.  That won't help much, though:  the velocity only has five-place accuracy.

Otherwise, you'll have to use the in-game value or else look into the mod files for the system parameters.  That should be easier, though:  if your mod is configured with Kopernicus, then the planet configuration files should have a section called Orbit that lists the semi-major axis by name.  You'll still need to calculate the orbital period yourself, but that's trivial compared to deriving the semi-major axis from (pseudo-)celestial observations.

I hope that helps.

Good luck!

Edited by Zhetaan
Link to comment
Share on other sites

A quick bit of rummaging in KER and I've found it- the tracking station KER window doesn't include orbital period by default but it's easy to add it in. Here's GPP's Otho:

JX2XUw6.png

Using T = 2π √(a3 / GM) where a is 72718.700Mm according to KER and GM for the star Ciro is 1.275e18m3/s2 according to the Tracking Station,

6.283185 * √(3.845e32 / 1.275e18) = 6.283185 * 17,366,570 = 109,117,381 seconds, or 11.8585 Kerbin years which is 11 years, 365.7 days- within a day of KER's value and literally a rounding error.

 

 

Link to comment
Share on other sites

9 hours ago, Zhetaan said:

Not to cause an argument, but if @jimmymcgoochie's suggestion holds, then I didn't see a local year readout anywhere in Kerbal Engineer.  It might be in later versions, though.

To your problem, @king of nowhere:

It's Kepler to the rescue!

Actually, that's not quite true; KSP does give you some information that Kepler didn't have.  However, it's largely the same problem, so we'll solve it the same way:  with (simulated) telescopes and a lot of (not simulated) maths.

If you don't mind a bit of calculation, then here's how to derive the answer from the information at hand:

 

what does it say about me that I prefer to run that calculation rather than installing another mod?

 

wait a minute, though: the formula works with distance from the center. ksp gives distance from the surface, so I will have to add the radius of the sun to r. not that it makes a huge difference

Edited by king of nowhere
Link to comment
Share on other sites

8 hours ago, king of nowhere said:

what does it say about me that I prefer to run that calculation rather than installing another mod?

Good things!

8 hours ago, king of nowhere said:

wait a minute, though: the formula works with distance from the center. ksp gives distance from the surface, so I will have to add the radius of the sun to r. not that it makes a huge difference

You're right!  It's been a while since I've tripped over that particular KSP quirk.  It makes enough of a difference:  the error becomes truly negligible at about four parts in ten thousand.  I've edited the earlier post to include that bit of data.

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