Jump to content

Browser based orbit calculator [Updated: version 0.3.5]


Recommended Posts

A simple JavaScript orbit calculator.

Requires a web browser that supports the canvas tag. Should work fine in Safari, Firefox, Chrome, or Opera, or recent versions of IE.

The calculator is a single self-contained HTML page, so you can easily download it and use it locally. The 'This Orbit' link will give URLs for the online version.

http://files.arklyffe.com/orbcalc.html

Version 0.3.5:

Fixed issue with the orbit renderer being too eager to stop drawing. Orbit traces no longer stop when they go past the top or bottom of the screen.

Restored the original input mode as Apsides/Apsis-Vel.

Shift-dragging no longer zooms, it instead adjusts velocity.

Tweaked zooming to keep the periapsis side of Kerbin on-screen.

Added red line to indicate approximate max distance within which gravity is accurately simulated by KSP.

Documentation is now on the calculator page itself.

Version 0.3.1:

Even better orbit rendering, no longer gets obviously polygonal with extremely eccentric ellipses and now renders hyperbolic orbits.

Fixed mouse dragging in apside-velocity mode.

Version 0.3 changes:

Has a version number. (0.3)

Has zoom. Shift-drag the mouse or use the buttons.

Entering velocities in apoapsis-periapsis mode adjusts altitudes in the same way that entering altitudes adjusts velocities.

'Ignore mouse' checkbox lets you protect your plot from stray mouse clicks

Better orbit rendering: orbits with high apogees no longer display inaccurate perigees.

More formatting cleanup.

Support for km and km/s.

Some more documentation.

It's actually hosted on my website (on Amazon S3, actually), and can now initialize its orbit parameters from a URL. Copy the 'This Orbit' link at the top left to get a URL containing the current orbit information.

Updated version (retroactively 0.2): better formatting of output, added above-mean-sea-level altitudes to the report, and lets you switch between adjusting periapsis and apoapsis, and adjusting altitude and velocity at periapsis or apoapsis...that is, adjusting the altitude and velocity of the opposite side of the orbit rather than the velocity of the side being adjusted. That's not of much practical use in planning orbits, but playing with it may be educational. And took the announcement here, which is probably a more appropriate forum.

Link to comment
Share on other sites

Super useful tool! I'm lazy and would rather have the file hosted somwhere, so I figured I'd share in my laziness by linking you fine folk.

http://instantmagnitude.com/files/orbcalc.html

cjameshuff, if you'd rather me not, I'll gladly take it down. No harm intended. ;D

An odd form of laziness...I don't mind, but I attached it as a standalone file partly out of paranoia about the traffic it might receive.

StrayEagle: I already linked the updated version. If you mean FatalFlux's hosted version, I just did that.

Link to comment
Share on other sites

So, how exactly do I use this to help myself... orbit?

Use it to calculate the right velocities for your desired orbit, or to calculate the velocities you need to accelerate or brake to to perform a Hohmann transfer, or to escape, or reenter. Or just use it to get a visual picture of your orbit, and make sure you're not going to bite into atmosphere on closest approach or something.

Link to comment
Share on other sites

I'm confused about how to properly enter data in this thing. I enter data in some parts of it and it changes the other entries. I took readings on my last orbit and tried entering them to see the orbit displayed however before I enter all the data it changes the other values. Is this not meant to be used that way and is instead exclusively for learning values to correct your orbits instead?

Link to comment
Share on other sites

You should be able to enter two entries, the ones that are indicated as locked, and the other values are calculated for you.

If you're using the orbitcalc.html, you can enter your Apogee and Perigee and it will tell you how fast you need to be going at both points to maintain that orbit. If you lock to Apogee and Velocity, put your height and speed at Apogee and it will tell you what your Perigee and speed should be to maintain orbit.

Cheers!

Skunky

Link to comment
Share on other sites

You should be able to enter two entries, the ones that are indicated as locked, and the other values are calculated for you.

If you're using the orbitcalc.html, you can enter your Apogee and Perigee and it will tell you how fast you need to be going at both points to maintain that orbit. If you lock to Apogee and Velocity, put your height and speed at Apogee and it will tell you what your Perigee and speed should be to maintain orbit.

Almost. In this version, if you enter velocity, it is assumed to go with the corresponding altitude, and velocity and altitude of the far side of the orbit are set regardless of mode. I'll probably change this to be more consistent in the next version though...specifying altitude-velocity, or altitude-altitude/velocity-velocity.

Next version will also have a 'safety' checkbox, so you don't mess up your orbit plot with a stray mouse click, zoom, and a different approach to rendering orbits that gives better results on highly eccentric orbits and doesn't have accuracy issues with very large orbits. And I'll write up some more documentation.

Link to comment
Share on other sites

Maybe I'm missing something, but when I switch the units to km, m/s and input a apoapsis of 10000, it sets the apoapsis to 609,400.0000 km. (Which, hilariously, would be an orbital period of ~ 206 days, realtime.)

Link to comment
Share on other sites

Maybe I'm missing something, but when I switch the units to km, m/s and input a apoapsis of 10000, it sets the apoapsis to 609,400.0000 km. (Which, hilariously, would be an orbital period of ~ 206 days, realtime.)

It was adding the sea level offset (in meters) before doing the conversion. I've uploaded a fixed version.

Also in this version: further improved drawing of elliptical orbits (much better at extremely eccentric ones), and drawing of parabolic/hyperbolic orbits.

Link to comment
Share on other sites

So if I understand this correctly from your documentation in order to project a Hohmann Transfer Orbit I enter my 'current' circular orbit then drag either the apoapsis or periapsis to my desired target orbit in order to create the Hohmann Elliptical orbit which I will use to transfer. I would then burn to achieve the velocity marked at whichever apsis coincides with my starting circular orbit. To level out after the intercept with the new orbit I circularize the elliptical orbit to the circular orbit I am now entering and use the apsis velocity data to set myself in line with it.

Make sense?

Link to comment
Share on other sites

So if I understand this correctly from your documentation in order to project a Hohmann Transfer Orbit I enter my 'current' circular orbit then drag either the apoapsis or periapsis to my desired target orbit in order to create the Hohmann Elliptical orbit which I will use to transfer. I would then burn to achieve the velocity marked at whichever apsis coincides with my starting circular orbit. To level out after the intercept with the new orbit I circularize the elliptical orbit to the circular orbit I am now entering and use the apsis velocity data to set myself in line with it.

Yes, that's it. To transfer to another orbit, burn to match velocities at a point where positions and directions coincide. A Hohmann transfer is just a transfer between circular orbits via an intermediate elliptical orbit. The calculator reports the overall delta-v required at each end of an elliptical orbit for transfer to/from a circular orbit, but this is mostly useful for planning purposes, to determine if you've got enough propellant to do the job...it's easier to burn to match a target velocity than to try to achieve a specific delta-v.

I might add another input mode to echo your entries to both apsides to let you directly set a circular orbit, but I'm not sure how much use it'd be. Maybe a keyboard shortcut to cycle parameter entry modes.

Link to comment
Share on other sites

...it's easier to burn to match a target velocity than to try to achieve a specific delta-v.

Could you explain that to me in specific terms? I don't understand the difference between the two. If you've got a source document I could read since you seem to know so much I'd like that too. Link or whatever you have.

Link to comment
Share on other sites

Could you explain that to me in specific terms? I don't understand the difference between the two. If you've got a source document I could read since you seem to know so much I'd like that too. Link or whatever you have.

Delta-v is change in velocity. If you're going at 2371.3 m/s and need to be going at 2419.1 m/s, it's easier to burn until your velocity is 2419.1 m/s than to burn enough to change your velocity by 47.8 m/s.

The Wikipedia articles on orbits are reasonably complete. Googling for 'orbital mechanics' gave several good results.

Link to comment
Share on other sites

I finally worked out how to use it! Yeah, it's been a while since college physics :).

I found myself at 38.000km, going 2300m/s. Using the calculator I worked out that this would take me into the atmosphere pretty damn quickly, and did a burn of a few seconds prograde. Got the speed up to 2700, and the calculator then showed me that this would give me an orbit with an apoapsis of 781km! Sure doesn't take much of a burn to change your orbit a great deal. I half an hour I'll know if I got it right :).

Link to comment
Share on other sites

Just released a new version.

I finally worked out how to use it! Yeah, it's been a while since college physics :).

Any particular remarks on usability? Unexpected behavior, unclear functionality?

I found myself at 38.000km, going 2300m/s. Using the calculator I worked out that this would take me into the atmosphere pretty damn quickly, and did a burn of a few seconds prograde. Got the speed up to 2700, and the calculator then showed me that this would give me an orbit with an apoapsis of 781km! Sure doesn't take much of a burn to change your orbit a great deal. I half an hour I'll know if I got it right :).

Especially at periapsis. The new version lets you adjust velocity with the mouse by shift-dragging, which illustrates the sensitivity to velocity pretty well.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 3 years later...
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...