JuliaSpace / SatelliteToolbox.jl

A toolbox for satellite analysis written in julia language.
MIT License
253 stars 34 forks source link

Sunposition? #3

Open stephancb opened 6 years ago

stephancb commented 6 years ago

Not really an issue, but I have code in native Julia for the sun position at given geodetic coordinates and time, returning zenith angle and azimuth. We use this to calculate the sun position relative to the satellite. It is quite fast. I never got around to put this into a package, but if you think it might fit, I would try to come up with a pull request for the SatelliteToolbox?

Some more details:

Functions for calculating the Sun's position described in Roberto Grena (2012), Five new algorithms for the computation of sun position from 2010 to 2110, Solar Energy, 86(5):1323–1337, doi:10.1016/j.solener.2012.01.024.

URLs: http://adsabs.harvard.edu/abs/2012SoEn...86.1323G

The Julia code was transcribed from C++ obtained at http://www.solaritaly.enea.it/StrSunPosition/SunPositionEn.php

by Stephan Buchert, Swedish Institute of Space Physics, scb@irfu.se

Examples for usage:

zenith,azimuth,rightAscension,declination,hourAngle = sunpos(...

ronisbr commented 6 years ago

Excellent! It will be very nice to have those algorithms. Now, we only have one very simple Sun determination algorithm here, which provides the sun position in ECI. You can add all of those and let the user select. Maybe it best way is to use multiple-dispatch, so the user can use it like:

sun_position_i(Val{:algorithm_1}, ...)
sun_position_i(Val{:algorithm_2}, ...)

Change the _i to _e maybe (ECEF)?

ronisbr commented 5 years ago

Hi @stephancb !

Do you still want to add those algorithms in SatelliteToolbox.jl?

stephancb commented 5 years ago

Hi Ronan,

yes, sorry for not doing it yet. The code is attached, it has comments. Included is also the original C++ code and documentation, it doesn't have a license.. SunPosition.jl.zip

I don't have any experience with creating pull requests etc., and became quite busy. If you have the possibility to add the algorithms to the satellite toolbox, this would be perfect.

Best regards, Stephan