Search in sources :

Example 6 with UnnormalizedSphericalHarmonics

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

the class GRGSFormatReaderTest method testReadLimits.

@Test
public void testReadLimits() throws OrekitException {
    GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim5_C1.dat", true));
    UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(3, 2);
    UnnormalizedSphericalHarmonics harmonics = provider.onDate(provider.getReferenceDate());
    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 7 with UnnormalizedSphericalHarmonics

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

the class GRGSFormatReaderTest method testRegular05cUnnormalized.

@Test
public void testRegular05cUnnormalized() throws OrekitException {
    GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim5_C1.dat", true));
    UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(5, 5);
    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.95857491635129E-06, 0.28175700027753E-11, maxUlps);
    checkValue(harmonics.getUnnormalizedCnm(5, 5), date, 5, 5, 1997, 1, 1, 0.17481512311600E-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.30882755318300E-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)

Example 8 with UnnormalizedSphericalHarmonics

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

the class GravityFieldFactoryTest method testUnnormalizer.

@Test
public void testUnnormalizer() throws OrekitException {
    Utils.setDataRoot("potential/icgem-format");
    final double shift = 1.23456e8;
    UnnormalizedSphericalHarmonicsProvider ref = GravityFieldFactory.getUnnormalizedProvider(5, 5);
    UnnormalizedSphericalHarmonics refHarmonics = ref.onDate(ref.getReferenceDate().shiftedBy(shift));
    NormalizedSphericalHarmonicsProvider normalized = GravityFieldFactory.getNormalizedProvider(5, 5);
    UnnormalizedSphericalHarmonicsProvider unnormalized = GravityFieldFactory.getUnnormalizedProvider(normalized);
    UnnormalizedSphericalHarmonics unnormalizedHarmonics = unnormalized.onDate(unnormalized.getReferenceDate().shiftedBy(shift));
    Assert.assertEquals(ref.getMaxDegree(), unnormalized.getMaxDegree());
    Assert.assertEquals(ref.getMaxOrder(), unnormalized.getMaxOrder());
    Assert.assertEquals(ref.getReferenceDate(), unnormalized.getReferenceDate());
    Assert.assertEquals(ref.getAe(), unnormalized.getAe(), FastMath.ulp(ref.getAe()));
    Assert.assertEquals(ref.getMu(), unnormalized.getMu(), FastMath.ulp(ref.getMu()));
    Assert.assertEquals(ref.getOffset(AbsoluteDate.GPS_EPOCH), unnormalized.getOffset(AbsoluteDate.GPS_EPOCH), FastMath.ulp(ref.getOffset(AbsoluteDate.GPS_EPOCH)));
    for (int i = 0; i <= 5; ++i) {
        for (int j = 0; j <= i; ++j) {
            double cRef = refHarmonics.getUnnormalizedCnm(i, j);
            double cTest = unnormalizedHarmonics.getUnnormalizedCnm(i, j);
            Assert.assertEquals(cRef, cTest, FastMath.ulp(cRef));
            double sRef = refHarmonics.getUnnormalizedSnm(i, j);
            double sTest = unnormalizedHarmonics.getUnnormalizedSnm(i, j);
            Assert.assertEquals(sRef, sTest, FastMath.ulp(sRef));
        }
    }
}
Also used : UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) Test(org.junit.Test)

Example 9 with UnnormalizedSphericalHarmonics

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

the class SHMFormatReaderTest method testReadLimits.

@Test
public void testReadLimits() throws OrekitException {
    Utils.setDataRoot("potential");
    GravityFieldFactory.addPotentialCoefficientsReader(new SHMFormatReader("eigen_cg03c_coef", false));
    UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(3, 2);
    UnnormalizedSphericalHarmonics harmonics = provider.onDate(provider.getReferenceDate());
    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 10 with UnnormalizedSphericalHarmonics

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

the class SHMFormatReaderTest method testRegular03cUnnormalized.

@Test
public void testRegular03cUnnormalized() throws OrekitException {
    Utils.setDataRoot("potential");
    GravityFieldFactory.addPotentialCoefficientsReader(new SHMFormatReader("eigen_cg03c_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.957201462136e-06, 0.490000000000e-11, maxUlps);
    checkValue(harmonics.getUnnormalizedCnm(5, 5), date, 5, 5, 1997, 1, 1, 0.174786174485e-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.308834784975e-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