# The detective story (3rd-body perturbation validation)

Hello everyone!

As I wrote in the previous post, the next thing to do was to add the 3rd body gravity account. The satellite is controlled not only by Earth gravity, but also by gravity of Moon, Jupiter, Sun, Venus et cetera. These effects might be considerable in some applications requiring high precision of coordinate and velocity prediction. Approximately, the effect of Moon and Sun gravity is of order 0.0001–0.00001 of Earth gravity. Still, these effects vary the Earth orbit parameters.

The difficulties started from the very beginning. First of all, in order to calculate the Moon’s force, one needs to know its position at time of integration. The Moon’s orbit is highly non-keplerian, so we had to use some special tables. But using these tables is quite costly, so we had to build an interpolant with required precision.

Once the position of 3rd body is known, we are ready to integrate! However, here comes the other problem that took me quite some time to figure out. As the magnitude of perturbations is really small, we had to integrate with much higher precision that we did previously.

One more problem was that in Curtis the data was averaged over time and did not account daily variations of orbit.

However, in the book there was nothing like this :) and it took me some time to understand that this is not my mistake, but some non-documented “feature” of the data.

The other problem was the true detective story :) In order to merge, we first need to validate our simulations against some existing data. And actually such data is present in Howard Curtis book. There are three types of orbits, that were perturbed by Moon and Sun. And for HEO (highly-eccentric orbit) we couldn’t get any agreement.

I first suspected that the problem is with high eccentricity and that our algorithm fails miserably in this case. However, with the advice from Juan, finally the problem was found… in the Curtis book itself! I took a look in their MATLAB script that was used and found that instead of initializing argument of perigee in degrees (as they claimed in the book), they initialized it in radians!

When we initialized our HEO in the same way, the agreement was finally reached for both Sun and Moon. And (hopefully) soon the PR will be merged :)

Next period, I think, I will continue doing time-dependent perturbations, especially Solar drag, the effect of Sun light pressure. As soon as I understood a lot with 3rd-body, this should not cause so many difficulties)