Simple Orbit Calculator - v1.5.0
Introducing my first KSP mod: Simple Orbit Calculator (SOC) is an in-game calculator to calculate basic orbital elements from pre-determined inputs.
History
This plugin is actually a realized in-game version of a previous tool I had written in Python for my personal use. When I started to really use Remote Tech, I became tired of all the "napkin math" I was doing to figure out the correct orbit elements needed to place my satellites where I wanted them, so I created said Python tool. This tool unfortunately was using hard-coded information from the wiki for the planets' physical and orbit characteristics, so if Squad were to make any changes to the planets, I wanted to play a RSS scaled version of the game, or I wanted to add planets such as those from Outer Planets Mod, I would need to manually make these changes.
I wrote this plugin to solve the above issues, and also to be a good way to learn modding for KSP. This not only is my first mod in KSP, it is also my first time dealing with Unity and first real project in C# (more familiar with Java and Python). Although I wrote this mostly for my personal use, I release it to the public in case anyone finds it as useful as I do.
Instructions for the orbit calculator
You can access the calculator by clicking the AppLauncher icon (or Blizzy's Toolbar icon) with the image of "SOC".
- Select the celestial body on the left.
- To the right of the celestial bodies, select two orbital elements (you cannot select both semi-major axis and orbital period; it would create an ambiguous case). The other elements will be disabled from input at this point.
- As an option, you can use either apoapsis/periapsis as altitudes above sea level of parent body or as distances from the center of the parent body. Just toggle the Use Altitudes for Apsides option near the bottom under Options.
- Enter your target values. The S button on the same row of the orbital period will set the orbital period to the parent body's rotation period (useful for synchronous orbits).
- Click the Calculate button, which will fill in the other elements and display below more in-depth information of the calculated orbit. Any errors will be reported.
- Optionally, if you are currently in a flight scene, you can click the Use Current Orbit button to use your current orbit or click the Use Target Orbit to use your target's orbit.
Because the calculation will fill in other elements that you did not choose, you will be free to use those easily in other calculations. Just de-select the elements you do not need, and select the new ones. This is very useful for calculating Hohmann transfers.
Instructions for the Hohmann transfer calculator
- Once you have calculated an orbit above, click either Save as Orbit 1 or Save as Orbit 2.
- When two orbits are saved that have the same parent body, the delta-v for the transfer will be calculated and displayed below.
- Click the C buttons to clear their respective orbits.
Instructions for the info mode
- Select the celestial body on the left.
- Toggle on Celestial Body Info Mode from the options on the right.
Javascript is disabled. View full album
Current Features
- Will automatically detect all celestial bodies known to KSP and their properties, including changes/additions by RSS or Planet Factory like mods.
- Allowed inputs include: Apoapsis, Periapsis, Semi-Major Axis, Eccentricity, Orbital Period.
- Other information displayed after calculation: Orbital Speeds at Apoapsis and Periapsis, Mean Orbital Speed, Launch Delta-V (the minimum dV required to launch to or land from the orbit), Max Darkness Length (useful for Remote Tech satellite electric charge calculations).
- Can use your current vessel's or target's orbit as input.
- Can save two orbits to calculate the delta-v required for a Hohmann transfer.
- Blizzy's Toolbar support.
- Celestial Body Info mode will display orbit and physical characteristics of the selected body, similar to that found on a wiki page.
Upcoming Features
- A better UI! (I'm still getting the hang of Unity scripting, so please forgive the current state of the UI).
- Possibly more input values.
- Ability to save orbits for re-use across saves/installs.
Thanks
Much thanks to Ferram, MOARdV and stupid_chris, whose source code on various projects helped me work out the AppLauncher code for the plugin.
Links
CKAN
Latest build not added to CKAN yet
ckan.exe install SimpleOrbitCalculator
Changelog
v1.5.0
- The revival of SOC!
-KSP 1.2.2 compatibility update. No feature updates.v1.4.0
- Celestial body info mode added!
- Orbit calculation now will display minimum ideal delta-V to launch to or land from calculated orbit, not including atmospheric drag.
- Parent body SOI moved to celestial body info mode.
- New warnings for orbits calculated to be outside of SOI or that intersect the planet.
- Users with Blizzy's Toolbar can now use the stock toolbar instead (requires restart).v1.3.1
- Previous release included wrong DLL, this has been fixed.v1.3.0
- While in flight scenes, can use your target's orbit as input.
- Blizzy's Toolbar support.
- Calculations, inputs and window location now persist between window closings and scene changes.
- Recursive search to order celestial bodies (this allows moons of moons and deeper... moon-ception, thanks OPM).v1.2.0
- Can save calculated orbits to calculate the Hohmann transfer delta-v.
- While in flight scenes, can use your active vessel's orbit as input.
- Code cleanup for the AppLauncher stuff (thanks for the help stupid_chris!).
- Code cleanup overall.v1.1.1
- KSP 1.0 compatibility update.v1.1.0
- Darkness time is now the longest amount of time that could be possibly spent in darkness (was originally assuming a circular orbit).
- Removed restrictions regarding hyperbolic trajectories (may result in some weird output numbers).
- Some code cleanup to prepare for future input values.v1.0.0
- Initial release for KSP 0.90.
License
This work is released under the GNU General Public License: http://www.gnu.org/licenses/.
Edited by stevehead
v1.5.0 update