compute_sun#

namespace saltro
namespace orbits

Functions

bool compute_sun(Eigen::Matrix<double, 3, saltro::limits::MAX_LENGTH_TRAJ> &R, const Eigen::Matrix<double, 1, saltro::limits::MAX_LENGTH_TRAJ> &jtime, const int jtime_length, const int sun_model, Eigen::Matrix<double, 3, saltro::limits::MAX_LENGTH_TRAJ> &S)#

Compute Sun position vectors along a trajectory using a selected model.

Dispatches Sun position computation to one of the available solar ephemeris models based on the integer selector sun_model.

For each trajectory sample \(k\), the spacecraft-to-Sun vector is evaluated as:

\[ \mathbf{S}_k = \mathbf{r}_{\odot}(t_k) - \mathbf{R}_k \]

where:

  • \(\mathbf{r}_{\odot}(t_k)\) is the Sun position in an Earth-centered inertial frame at time \(t_k\),

  • \(\mathbf{R}_k\) is the spacecraft position vector (meters),

  • \(\mathbf{S}_k\) is the resulting spacecraft-to-Sun vector (meters).

Supported models:

  • \(0\) → NOAA solar position algorithm

  • \(1\) → NREL Solar Position Algorithm (SPA)

The output Sun vector matrix is written column-wise:

\[ \mathbf{S} = \begin{bmatrix} \mathbf{S}_0 & \mathbf{S}_1 & \cdots & \mathbf{S}_{N-1} \end{bmatrix} \]

This function performs model selection only; the physical solar ephemeris computation is delegated to the corresponding model implementation.

Parameters:
  • R – Spacecraft position vectors (meters). Each column corresponds to one trajectory sample.

  • jtime – Julian centuries associated with each trajectory sample.

  • jtime_length – Number of valid trajectory samples.

  • sun_model – Integer identifier selecting the solar model: 0 = NOAA, 1 = NREL SPA.

  • S – Output spacecraft-to-Sun vectors (meters), column-wise.

Returns:

True if the selected model computation succeeds for all samples, false if the model identifier is invalid or a computation fails.