test_eclipse

test_eclipse.test_unitEclipse(show_plots, eclipseCondition, planet)[source]

Test Description and Success Criteria

The unit test validates the internal aspects of the Basilisk eclipse module by comparing simulated output with expected output. It validates the computation of a shadow factor for total eclipse, partial eclipse,annular eclipse, and no eclipse scenarios. The test is designed to analyze one type at a time for both Earth and Mars and is then repeated for all three.

Earth is set as the zero base for all eclipse types to test it as the occulting body. For full, partial, and no eclipse cases, orbital elements describing the spacecraft states are then converted to Cartesian vectors. These orbital elements vary for each eclipse type since the Sun and planet states are fixed. The conversion is made using the orbitalMotion elem2rv function, where the inputs are six orbital elements (a, e, i, Omega, omega, f) and the outputs are Cartesian position and velocity vectors. For the annular eclipse case, the conversion is avoided and a Cartesian position vector is initially provided instead. The vectors are then passed into spacecraft and, subsequently, the eclipse module through the Basilisk messaging system.

Testing the no eclipse case with Mars as the occulting body is the same as the Earth no eclipse test, except Mars is set as the zero base. The Mars full, partial, and annular eclipse cases, however, are like the Earth annular case where Cartesian vectors are, instead, the initial inputs. Since the test is performed as a single step process, the velocity is not necessarily needed as an input, so only a position vector is provided for these cases.

The shadow factor obtained through the module is compared to the expected result, which is either trivial or calculated, depending on the eclipse type. Full eclipse and no eclipse shadow factors are compared without the need for computation, since they are just 0.0 and 1.0, respectively. The partial and annular eclipse shadow factors, however, vary between 0.0 and 1.0, based on the cone dimensions, and are calculated using MATLAB and Spice data.

Test Parameters:

  • eclipseCondition: [string] defines if the eclipse is partial, full, none or annular

  • planet: [string] defines which planet to use. Options include “earth” and “mars”

Description of Variables Being Tested

In each test scenario the shadow eclipse variable

shadowFactor

is pulled from the log data and compared to expected truth values.

test_eclipse.test_unitEclipseCustom(show_plots)[source]

Test Description and Success Criteria

The unit test validates the internal aspects of the Basilisk eclipse module by comparing simulated output with expected output. It validates the computation of a shadow factor for total eclipse using a custom gravity body.

This unit test sets up a custom gravity body, the asteroid Bennu, using the planetEphemeris module (i.e. Spice is not used for this test.) An empty spice planet message is created for the sun. The spacecraft is set 500 m on the side of the asteroid opposite of the sun.

The shadow factor obtained through the module is compared to the expected result, which is trivial to compute.

Description of Variables Being Tested

In this test scenario the shadow eclipse variable

shadowFactor

is pulled from the log data and compared to the expected truth value.