Jump to content

[1.2.2] SOC: Simple Orbit Calculator v1.5.0 (1/12/2017)


stevehead

Recommended Posts

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

  1. Select the celestial body on the left.
  2. 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.
  3. 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.
  4. 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).
  5. 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.
  6. 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

  1. Once you have calculated an orbit above, click either Save as Orbit 1 or Save as Orbit 2.
  2. When two orbits are saved that have the same parent body, the delta-v for the transfer will be calculated and displayed below.
  3. Click the C buttons to clear their respective orbits.

Instructions for the info mode

  1. Select the celestial body on the left.
  2. 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

Download from GitHub

Source Code on GitHub

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
Link to comment
Share on other sites

It doesn't change anything in the game, like changing your current vessel's orbit or anything like that. It it just a calculator in which you input values, and it calculates the rest of the orbit for you. I use it for planning the placement of satellites in Remote Tech, for example.

Link to comment
Share on other sites

It doesn't change anything in the game, like changing your current vessel's orbit or anything like that. It it just a calculator in which you input values, and it calculates the rest of the orbit for you. I use it for planning the placement of satellites in Remote Tech, for example.
Oh I get it. I'll check it out soon.
Link to comment
Share on other sites

It looks useful, especially for RSS and RO, also, when are you going to make it so that it calculates the amount of Delta-V needed to get from the ground to orbit?

Thanks for this AWESOME Mod!

Link to comment
Share on other sites

Thanks to everyone so far! I'm going to try to find time to make improvements over the next day or two. I got the mod in a functional state and I wanted to get it released before I call it quits for the remainder of the weekend.

It looks useful, especially for RSS and RO, also, when are you going to make it so that it calculates the amount of Delta-V needed to get from the ground to orbit?

Thanks for this AWESOME Mod!

Calculating the delta-v to launch into orbit is very tricky. There are so many variables to consider such as gravity loses due to various TWR, how steep or shallow your ascent is, how aerodynamic your spacecraft is for atmospheric launches. It would be best to just check out one of the delta-v charts people have made (e.g. stock scale and aerodynamics). Say for example, I wanted to launch into a 500km x 500km orbit around Kerbin, I know I would need ~4500 m/s to get into a 80km parking orbit; using my calculator, I can figure I need about 480 m/s to transfer from the 80km to 500km orbit with circularization; so worst case scenario, I would need about 5 km/s to get into the 500x500 orbit, but I also know it would be more efficient to launch directly into the 500km without getting into the 80km parking orbit first.

My next goal is to have the calculator automatically calculate the delta-v between the two orbits. Right now, that can be manually done by using the periapsis and apoapsis speeds that my calculator outputs, but requires three separate orbits calculated (the original orbit, the Hohmann transfer orbit, and the final orbit) and some "napkin math".

Edit: Also, I would like the mod to have the ability to use your current active vessel's or target's orbit in the delta-v calculations.

Edited by stevehead
Link to comment
Share on other sites

A tool I've used in prior versions was this thing : http://forum.kerbalspaceprogram.com/threads/95072

I wonder if some of the math has already been done; in any case, your tool looks to be far more general in use!

Thanks for the work, it's a darn sight better than my programming skills >< (and, make sure to work at your own pace!)

Link to comment
Share on other sites

v1.1.0 Released

GitHub Download

Changes:

- Darkness time is now the longest amount of time that could be possibly spent in darkness (link to equation; 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.

Link to comment
Share on other sites

Woot nice mod. Simple doesn't mean an less value! Helps emmensly for RT as stated or trying to find a syncronus orbit on new or resized planets. One request if you are able or are open to suggestions. I HATE the stock toolbar it's clutter to me that I can't hide, so I humbly request blizzy toolbar support. Either way still love the mod and will never uninstall.

Link to comment
Share on other sites

Woot nice mod. Simple doesn't mean an less value! Helps emmensly for RT as stated or trying to find a syncronus orbit on new or resized planets. One request if you are able or are open to suggestions. I HATE the stock toolbar it's clutter to me that I can't hide, so I humbly request blizzy toolbar support. Either way still love the mod and will never uninstall.

That's something I have been thinking of adding. I'll look into it for a near future release.

Link to comment
Share on other sites

I use mods that double the scale of Kerbin and other worlds. Is there a way of making this compatible with those changes? Anyway, the mod looks like a great addition, thumbs up!

With how the mod is coded, the current version of SOC should be compatible with RSS and any of the various scales out there, and should auto detect any new planets such as those from Outer Planets mod. In fact, those are the specific reasons I made the mod since I prefer to play 6.4x scale. The previous versions for KSP 0.90 were verified to work with those mods, but I haven't been able to verify this version with KSP 1.0 since those mods haven't been updated yet.

Link to comment
Share on other sites

I've verified that SOC runs on 1.0.2 without any problems (no surprise since it wasn't a major update).

I've been more focused on my launch failure mod the past couple of days, but I got that in a good state for now for me to get back to this mod. The Hohmann transfer calculations are completed, I just want to cleanup the code that handles the AppLauncher hooks that were changed in 1.0 and also possibly get Blizzy's toolbar support in before I release the next version. Unfortunately, good ole' spring allergies have hit me... may take a break for a day. We'll see.

Edited by stevehead
Link to comment
Share on other sites

v1.2.0 Released

Kerbal Stuff Download

GitHub Download

Changes:

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

Edit: Should point out that I have yet to add Blizzy's toolbar support. That is on my list of things for the next release.

Edited by stevehead
Link to comment
Share on other sites

Sometime this week I'm planning to release a small update. I've noticed how annoying it is to close the window and have it wipe all of your calculations. I'm going to add in-game persistence.

This is for later: I'm also thinking of adding the ability to actually save your orbits for re-use. This would be saved to a file in the mod's folder as opposed to your save file, allowing the saved orbits to be used in any of your game saves.

So here's the plan:

Small Update (this week, possibly)

Prevent your inputs/calculations from being cleared out every time you close the window.

Normal Update (in the near future)

Blizzy's Toolbar Support

Button to use your target's orbit.

Normal Update (in the somewhat-near future)

Ability to save orbits to a file for re-use at any time.

Edited by stevehead
target orbit button
Link to comment
Share on other sites

v1.3.0 Released

This release did not include the correct DLL. Please download v1.3.1 instead.

Changes:

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

Next release will add the setting to force the stock toolbar to be used instead of Blizzy's toolbar.

Edited by stevehead
wrong DLL included
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...