Search in sources :

Example 11 with UnnormalizedSphericalHarmonics

use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.

the class ICGEMFormatReaderTest method testMissingDegree1.

/**
 * check files without 1,0 and 1,1 can be parsed.
 */
@Test
public void testMissingDegree1() throws OrekitException {
    Utils.setDataRoot("potential");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("dummy_missing_degree_1", false));
    UnnormalizedSphericalHarmonics harmonics = GravityFieldFactory.getUnnormalizedProvider(2, 2).onDate(AbsoluteDate.J2000_EPOCH);
    // check coefficients not in the file are initialized correctly
    Assert.assertEquals(0.0, harmonics.getUnnormalizedCnm(1, 0), 0.0);
    Assert.assertEquals(0.0, harmonics.getUnnormalizedCnm(1, 1), 0.0);
    // check a coefficient is read correctly
    Assert.assertEquals(10.0, harmonics.getUnnormalizedCnm(2, 2), 0.0);
}
Also used : UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) Test(org.junit.Test)

Example 12 with UnnormalizedSphericalHarmonics

use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.

the class ICGEMFormatReaderTest method testEigen06.

@Test
public void testEigen06() throws OrekitException {
    Utils.setDataRoot("potential");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("eigen-6s-truncated", false));
    UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(5, 5);
    Assert.assertEquals(TideSystem.TIDE_FREE, provider.getTideSystem());
    AbsoluteDate refDate = new AbsoluteDate("2005-01-01T12:00:00", TimeScalesFactory.getTT());
    Assert.assertEquals(refDate, provider.getReferenceDate());
    AbsoluteDate date = new AbsoluteDate("2013-01-08T10:46:53", TimeScalesFactory.getTT());
    Assert.assertEquals(date.durationFrom(refDate), provider.getOffset(date), Precision.SAFE_MIN);
    UnnormalizedSphericalHarmonics harmonics = provider.onDate(date);
    int maxUlps = 2;
    checkValue(harmonics.getUnnormalizedCnm(3, 0), date, 3, 0, 2005, 1, 1, 9.57211326674e-07, -8.37191630994e-12, -1.76087178236e-11, 9.47617140143e-11, 1.06252954726e-11, -9.12524501214e-12, maxUlps);
    checkValue(harmonics.getUnnormalizedCnm(5, 5), date, 5, 5, 2005, 1, 1, 1.74807033099e-07, -1.33498578664e-12, -2.76043013690e-12, -8.28591865697e-12, 1.57898939101e-12, 2.90931436419e-12, maxUlps);
    checkValue(harmonics.getUnnormalizedSnm(4, 0), date, 4, 0, 2005, 1, 1, 0, 0, 0, 0, 0, 0, maxUlps);
    checkValue(harmonics.getUnnormalizedSnm(4, 4), date, 4, 4, 2005, 1, 1, 3.08820169866e-07, 4.35447782358e-13, -1.21823769110e-11, 3.89722186321e-11, 7.28153817742e-12, -7.64506592459e-12, maxUlps);
    Assert.assertEquals(0.3986004415E+15, provider.getMu(), 1.0e-20);
    Assert.assertEquals(0.6378136460E+07, provider.getAe(), 1.0e-20);
}
Also used : UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 13 with UnnormalizedSphericalHarmonics

use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.

the class ICGEMFormatReaderTest method testReadLimits.

@Test
public void testReadLimits() throws OrekitException {
    Utils.setDataRoot("potential");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("g007_eigen_05c_coef", false));
    UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(3, 2);
    UnnormalizedSphericalHarmonics harmonics = provider.onDate(provider.getReferenceDate());
    Assert.assertEquals(TideSystem.TIDE_FREE, provider.getTideSystem());
    try {
        harmonics.getUnnormalizedCnm(3, 3);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
    // expected
    } catch (Exception e) {
        Assert.fail("wrong exception caught: " + e.getLocalizedMessage());
    }
    try {
        harmonics.getUnnormalizedCnm(4, 2);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
    // expected
    } catch (Exception e) {
        Assert.fail("wrong exception caught: " + e.getLocalizedMessage());
    }
    harmonics.getUnnormalizedCnm(3, 2);
    Assert.assertEquals(3, provider.getMaxDegree());
    Assert.assertEquals(2, provider.getMaxOrder());
}
Also used : OrekitException(org.orekit.errors.OrekitException) UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 14 with UnnormalizedSphericalHarmonics

use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.

the class ICGEMFormatReaderTest method testRegular05cUnnormalized.

@Test
public void testRegular05cUnnormalized() throws OrekitException {
    Utils.setDataRoot("potential");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("g007_eigen_05c_coef", false));
    UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(5, 5);
    Assert.assertEquals(TideSystem.TIDE_FREE, provider.getTideSystem());
    AbsoluteDate refDate = new AbsoluteDate("2004-10-01T12:00:00", TimeScalesFactory.getTT());
    Assert.assertEquals(refDate, provider.getReferenceDate());
    AbsoluteDate date = new AbsoluteDate("2013-01-08T10:46:53", TimeScalesFactory.getTT());
    Assert.assertEquals(date.durationFrom(refDate), provider.getOffset(date), Precision.SAFE_MIN);
    UnnormalizedSphericalHarmonics harmonics = provider.onDate(date);
    int maxUlps = 2;
    checkValue(harmonics.getUnnormalizedCnm(3, 0), date, 3, 0, 2004, 10, 1, 0.957212879862e-06, 0.490000000000e-11, 0, 0, 0, 0, maxUlps);
    checkValue(harmonics.getUnnormalizedCnm(5, 5), date, 5, 5, 2004, 10, 1, 0.174804558032e-06, 0, 0, 0, 0, 0, maxUlps);
    checkValue(harmonics.getUnnormalizedSnm(4, 0), date, 4, 0, 2004, 10, 1, 0, 0, 0, 0, 0, 0, maxUlps);
    checkValue(harmonics.getUnnormalizedSnm(4, 4), date, 4, 4, 2004, 10, 1, 0.308816581016e-06, 0, 0, 0, 0, 0, maxUlps);
    Assert.assertEquals(0.3986004415E+15, provider.getMu(), 1.0e-20);
    Assert.assertEquals(0.6378136460E+07, provider.getAe(), 1.0e-20);
}
Also used : UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 15 with UnnormalizedSphericalHarmonics

use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics in project Orekit by CS-SI.

the class SHMFormatReaderTest method testReadCompressed01c.

@Test
public void testReadCompressed01c() throws OrekitException {
    Utils.setDataRoot("potential");
    GravityFieldFactory.addPotentialCoefficientsReader(new SHMFormatReader("compressed-eigen-cg01c_coef", false));
    UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(5, 5);
    Assert.assertEquals(TideSystem.TIDE_FREE, provider.getTideSystem());
    AbsoluteDate refDate = new AbsoluteDate("1997-01-01T12:00:00", TimeScalesFactory.getTT());
    Assert.assertEquals(refDate, provider.getReferenceDate());
    AbsoluteDate date = new AbsoluteDate("2011-05-01T01:02:03", TimeScalesFactory.getTT());
    Assert.assertEquals(date.durationFrom(refDate), provider.getOffset(date), Precision.SAFE_MIN);
    UnnormalizedSphericalHarmonics harmonics = provider.onDate(date);
    int maxUlps = 2;
    checkValue(harmonics.getUnnormalizedCnm(3, 0), date, 3, 0, 1997, 1, 1, 0.957187536534E-06, 0.490000000000E-11, maxUlps);
    checkValue(harmonics.getUnnormalizedCnm(5, 5), date, 5, 5, 1997, 1, 1, 0.174787189024E-06, 0.0, maxUlps);
    checkValue(harmonics.getUnnormalizedSnm(4, 0), date, 4, 0, 1997, 1, 1, 0, 0, maxUlps);
    checkValue(harmonics.getUnnormalizedSnm(4, 4), date, 4, 4, 1997, 1, 1, 0.308834848269E-06, 0, maxUlps);
    Assert.assertEquals(0.3986004415E+15, provider.getMu(), 0);
    Assert.assertEquals(0.6378136460E+07, provider.getAe(), 0);
}
Also used : UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

UnnormalizedSphericalHarmonics (org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics)17 Test (org.junit.Test)13 AbsoluteDate (org.orekit.time.AbsoluteDate)6 OrekitException (org.orekit.errors.OrekitException)4 ArrayList (java.util.ArrayList)1 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)1 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)1 CircularOrbit (org.orekit.orbits.CircularOrbit)1 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)1 Orbit (org.orekit.orbits.Orbit)1 Propagator (org.orekit.propagation.Propagator)1 SpacecraftState (org.orekit.propagation.SpacecraftState)1 EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)1 NSKey (org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey)1 HansenTesseralLinear (org.orekit.propagation.semianalytical.dsst.utilities.hansen.HansenTesseralLinear)1 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)1