You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I work with orbit propagation and I have been used Vallado MATLAB package for a long time. Currently, I am using satellite.js for a web-based project and I realized not all of the functions are converted from the original Vallado code. Since I personally needed the Sun position in my project, I converted the MATLAB function "sun.mat" from the Vallado package to Javascript "sun.js".
Since it is very short and simple, I would like to share it here. Maybe it becomes useful for some users. sun.js.txt
(Remove .txt extension)
To use, just simply add sun.js after loading satellite.js in your page. This function gets JulianDate as input and returns Sun position/ascension/declination as the output.
Since the MATLAB syntax is very simple, it is easy to convert the whole Vallado package to JavaScript and satellite.js. I think adding this (and also other functions from the original package) to satellite.js makes it more practical for various projects.
Cheers
The text was updated successfully, but these errors were encountered:
spacenewb
added a commit
to spacenewb/satellite-js
that referenced
this issue
Sep 11, 2023
Implemented function `sunPos`, to calculate sun position. This resolves issue shashwatak#68 .
The name of the function is slightly changed for clarity and added references.
Cleaned the ported code `sun.js.txt` as provided in the original issue.
Removed `var` declarations within the function to augment performance.
This looks like valid code and I hope it helps others, but there are no plans to upgrade this library. If you are looking for sun position or ra/dec caclulations for the sun or stars I recommend looking at the OP's solution or the following libraries:
Hi,
I work with orbit propagation and I have been used Vallado MATLAB package for a long time. Currently, I am using satellite.js for a web-based project and I realized not all of the functions are converted from the original Vallado code. Since I personally needed the Sun position in my project, I converted the MATLAB function "sun.mat" from the Vallado package to Javascript "sun.js".
Since it is very short and simple, I would like to share it here. Maybe it becomes useful for some users.
sun.js.txt
(Remove .txt extension)
To use, just simply add sun.js after loading satellite.js in your page. This function gets JulianDate as input and returns Sun position/ascension/declination as the output.
Since the MATLAB syntax is very simple, it is easy to convert the whole Vallado package to JavaScript and satellite.js. I think adding this (and also other functions from the original package) to satellite.js makes it more practical for various projects.
Cheers
The text was updated successfully, but these errors were encountered: