# Does a solar geometry library exist for satellites in LEO?

I'm looking for a solar geometry library built for a cubesat in LEO. In my research so far, I've discovered the MINES Paris-Tech Solar Geometry 2 library (http://www.oie.mines-paristech.fr/Valorisation/Outils/Solar-Geometry/) which is a does something like what I need, but it only applies to earth-based observatories.

Instead, I'm looking to provide coordinates (ECI, Geodetic, or something similar) and time stamp as the input. For output, I'm looking to generate a vector that describes the orientation of the satellite relative to the sun given that position, and will calculate if we are in an eclipse or not using that data.

Does something similar exist for LEO (roughly 450km)? Ideally it would be in C but anything similar is certainly usable.

• Welcome to Space! Do you need just a geometry calculator for a known satellite position, or do you need both a geometry calculator like the Paris-Tech link, ("...which is exactly what I am looking for...") and also an orbit propagator for LEO as well? While an observatory's short-term motion in space is relatively easy to calculate (it circles the Earth's axis) a satellite's short-term motion is quite hard to calculate and would be a much bigger part of the problem than the geometry part. Also, since satellites don't have a hemispherical "sky" with well defined altitude/azimuth (continued)
– uhoh
Oct 23, 2018 at 1:25
• it can't really be "exactly" like the Paris-Tech software. The output will be more complex. The more you can explain exactly what you need, the better!
– uhoh
Oct 23, 2018 at 1:27
• Hi @uhoh, thanks for the response, I see what you're saying. For my code (maybe propagator is a bad way to describe it), I'm looking to provide coordinates (ECI, Geodetic, or something similar) and time stamp as the input. For output, I'm looking to generate a vector that describes the orientation of the satellite relative to the sun given that position, and will calculate if we are in an eclipse or not using that data.
– Ben
Oct 23, 2018 at 18:30
• @uhoh I should also add that (outside of the scope of this question) that I am searching for an orbital propagator as well, so if that happens to be something you can direct me towards it would be appreciated as well :)
– Ben
Oct 23, 2018 at 21:34
• Okay I've added your very clear description back into your post. Very often people won't read through the comments, so this way all readers will see it. In general it's good to think of comments as a temporary workspace to address and refine the posts. Comments can be cleaned up unexpectedly, so as long as they don't conflict with existing answers, refinements to questions should be implemented in the post.
– uhoh
Oct 23, 2018 at 23:51

Approximations you can code up simply: Plain-text keplerian elements are available on the NASA JPL website: https://ssd.jpl.nasa.gov/?planet_pos These give good approximations up to the year 2050

If you need something more precise then the Planetary Ephemerides DE431 is a good place to go: https://ipnpr.jpl.nasa.gov/progress_report/42-196/196C.pdf

Project Pluto provides libraries for either approach in C https://www.projectpluto.com/jpl_eph.htm

• Those doesn't really directly address "For output, I'm looking to generate a vector that describes the orientation of the satellite relative to the sun given that position, and will calculate if we are in an eclipse or not using that data." Helpful comment, yes, but can you try to address directly the problem that the OP has described? "Use these and then (somehow) write a program to calculate what you want" is probably not sufficient as an answer.
– uhoh
Oct 26, 2018 at 16:45
• I read the question as looking libraries - "Does this exist in C or otherwise" so was pointing them in the direction of that library. I went off the last two lines of the question, but more detail would require a lot more time on my part. Oct 26, 2018 at 16:56

Does a solar geometry library exist for satellites in LEO?

Almost certainly, but it's also almost certainly hidden. Your question can be broadened:

Does a generic, freely available geometry library exist for satellites in any orbit about any planet (or even in transit between planets)?

Here the answer is YES, not just a boring yes in the standard font and style, but yes in all-caps and bold-faced. That library would be the SPICE Toolkit. A good chunk of SPICE deals specifically with answering geometry questions such as "at time=T, where do I need point my interplanetary satellite so it can communicate with a ground station on the Earth?" SPICE also has a geometry finder subsystem that does the inverse: "At what times is the Earth in view for my satellite?" (Or, in your case, at what times is the Sun in view for my satellite?)

There's one gotcha that might well trip you up, which is that the geometry finder functions need you to describe the position of your satellite as a continuous function of time in the form of a SPICE SPK kernel. A brute force way to do this is to provide a dense time series of cartesian positions, dense enough such that linear interpolation between points in the series yields a sufficiently accurate estimate of the spacecraft position. It's possible to do much better than this brute force approach with higher order polynomials. Unless you know the mathematics of and the potential pitfalls of using higher order polynomials, I'd recommend the brute force approach.

• I had no idea that exists, how incredibly useful!
– uhoh
Nov 3, 2018 at 10:52
• SPICE intentionally does not provide functions that reduce a dense time series to a nice compact polynomial model for two reasons. One is doing so requires that the developer knows the math and knows the potential pitfalls. The other reason is that SPICE is freely available, world-wide, and the SPICE developers want to keep it that way. In particular, SPICE is not ITAR-restricted. If SPICE did provide said functionality, SPICE would almost certainly would be ITAR-restricted and would not be freely-available, world-wide. Nov 3, 2018 at 10:58
• @uhoh - A website that might interest you: WebGeocalc - A GUI Interface to SPICE . Beats the pants off of HORIZONS, if you know what you're doing. Nov 3, 2018 at 11:32
• Wow, candy!! Oh there goes the weekend. I had no idea anything like that existed!! I can hide from the curly braces for another few weeks at least, yay!
– uhoh
Nov 3, 2018 at 11:45
• @uhon - Another JPL tool that will intrigue you, since you are visually oriented: Cosmographia. Several (five??) years ago, one of the key developers of Celestia wanted to tie Celestia to SPICE. He made his contribution open source, but it didn't quite bite. JPL saw what he did and made that the initial version of Cosmographia. JPL recently hired that young man. The tools he originally used (e.g. Qt) have been upgraded in a non backwards-compatible way. He's in the process of updating Cosmographia to the new Qt. Nov 3, 2018 at 12:02