@Test
  public void testUnsupportedParameter() throws OrekitException {
    Orbit initialOrbit =
        new KeplerianOrbit(
            8000000.0,
            0.01,
            0.1,
            0.7,
            0,
            1.2,
            PositionAngle.TRUE,
            FramesFactory.getEME2000(),
            AbsoluteDate.J2000_EPOCH,
            Constants.EIGEN5C_EARTH_MU);

    double dP = 0.001;
    NumericalPropagator propagator =
        setUpPropagator(
            initialOrbit,
            dP,
            OrbitType.EQUINOCTIAL,
            PositionAngle.TRUE,
            new ThirdBodyAttraction(CelestialBodyFactory.getSun()),
            new ThirdBodyAttraction(CelestialBodyFactory.getMoon()));
    PartialDerivativesEquations partials = new PartialDerivativesEquations("partials", propagator);
    partials.selectParamAndStep("non-existent", 1.0);
    try {
      partials.computeDerivatives(new SpacecraftState(initialOrbit), new double[6]);
      Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
      Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
    }
  }
  @Test
  public void testWrongParametersDimension() throws OrekitException {
    Orbit initialOrbit =
        new KeplerianOrbit(
            8000000.0,
            0.01,
            0.1,
            0.7,
            0,
            1.2,
            PositionAngle.TRUE,
            FramesFactory.getEME2000(),
            AbsoluteDate.J2000_EPOCH,
            Constants.EIGEN5C_EARTH_MU);

    double dP = 0.001;
    NumericalPropagator propagator =
        setUpPropagator(
            initialOrbit,
            dP,
            OrbitType.EQUINOCTIAL,
            PositionAngle.TRUE,
            new ThirdBodyAttraction(CelestialBodyFactory.getSun()),
            new ThirdBodyAttraction(CelestialBodyFactory.getMoon()));
    PartialDerivativesEquations partials = new PartialDerivativesEquations("partials", propagator);
    partials.setInitialJacobians(
        new SpacecraftState(initialOrbit), new double[6][6], new double[6][3]);
    partials.selectParameters("Sun attraction coefficient");
    try {
      partials.computeDerivatives(new SpacecraftState(initialOrbit), new double[6]);
      Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
      Assert.assertEquals(
          OrekitMessages.INITIAL_MATRIX_AND_PARAMETERS_NUMBER_MISMATCH, oe.getSpecifier());
    }
  }
 public static void clearFactories() {
   OrekitUtils.clearFactoryMaps(CelestialBodyFactory.class);
   CelestialBodyFactory.clearCelestialBodyLoaders();
   OrekitUtils.clearFactoryMaps(FramesFactory.class);
   OrekitUtils.clearFactoryMaps(TimeScalesFactory.class);
   OrekitUtils.clearFactory(TimeScalesFactory.class, TimeScale.class);
   OrekitUtils.clearFactoryMaps(JacobiPolynomials.class);
   OrekitUtils.clearFactoryMaps(NewcombOperators.class);
   for (final Class<?> c : NewcombOperators.class.getDeclaredClasses()) {
     if (c.getName().endsWith("PolynomialsGenerator")) {
       OrekitUtils.clearFactoryMaps(c);
     }
   }
   // FramesFactory.setEOPContinuityThreshold(5 * Constants.JULIAN_DAY);
   // TimeScalesFactory.clearUTCTAILoaders();
   OrekitUtils.clearJPLEphemeridesConstants();
   GravityFieldFactory.clearPotentialCoefficientsReaders();
   GravityFieldFactory.clearOceanTidesReaders();
   DataProvidersManager.getInstance().clearProviders();
   DataProvidersManager.getInstance().clearLoadedDataNames();
 }
Exemple #4
0
  @Test
  public void testWithOriginalTestsCases() throws OrekitException, ParseException {

    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.460, 1.0 / 298.257222101, itrf);
    SolarInputs97to05 in = SolarInputs97to05.getInstance();
    earth.setAngularThreshold(1e-10);
    DTM2000 atm = new DTM2000(in, sun, earth);
    double roTestCase;
    double tzTestCase;
    double tinfTestCase;
    double myRo;

    // Inputs :
    //      alt=800.
    //      lat=40.
    //      day=185.
    //      hl=16.
    //      xlon=0.
    //      fm(1)=150.
    //      f(1) =fm(1)
    //      fm(2)=0.
    //      f(2)=0.
    //      akp(1)=0.
    //      akp(2)=0.
    //      akp(3)=0.
    //      akp(4)=0.

    // Outputs :
    roTestCase = 1.8710001353820e-17 * 1000;
    tzTestCase = 1165.4839828984;
    tinfTestCase = 1165.4919505608;

    // Computation and results
    myRo =
        atm.getDensity(
            185, 800 * 1000, 0, FastMath.toRadians(40), 16 * FastMath.PI / 12, 150, 150, 0, 0);
    Assert.assertEquals(0, (roTestCase - myRo) / roTestCase, 1e-14);
    Assert.assertEquals(0, (tzTestCase - atm.getT()) / tzTestCase, 1e-13);
    Assert.assertEquals(0, (tinfTestCase - atm.getTinf()) / tinfTestCase, 1e-13);

    //      IDEM., day=275

    roTestCase = 2.8524195214905e-17 * 1000;
    tzTestCase = 1157.1872001392;
    tinfTestCase = 1157.1933514185;

    myRo =
        atm.getDensity(
            275, 800 * 1000, 0, FastMath.toRadians(40), 16 * FastMath.PI / 12, 150, 150, 0, 0);
    Assert.assertEquals(0, (roTestCase - myRo) / roTestCase, 1e-14);
    Assert.assertEquals(0, (tzTestCase - atm.getT()) / tzTestCase, 1e-13);
    Assert.assertEquals(0, (tinfTestCase - atm.getTinf()) / tinfTestCase, 1e-13);

    //      IDEM., day=355

    roTestCase = 1.7343324462212e-17 * 1000;
    tzTestCase = 1033.0277846356;
    tinfTestCase = 1033.0282703200;

    myRo =
        atm.getDensity(
            355, 800 * 1000, 0, FastMath.toRadians(40), 16 * FastMath.PI / 12, 150, 150, 0, 0);
    Assert.assertEquals(0, (roTestCase - myRo) / roTestCase, 2e-14);
    Assert.assertEquals(0, (tzTestCase - atm.getT()) / tzTestCase, 1e-13);
    Assert.assertEquals(0, (tinfTestCase - atm.getTinf()) / tinfTestCase, 1e-13);
    //      IDEM., day=85

    roTestCase = 2.9983740796297e-17 * 1000;
    tzTestCase = 1169.5405086196;
    tinfTestCase = 1169.5485768345;

    myRo =
        atm.getDensity(
            85, 800 * 1000, 0, FastMath.toRadians(40), 16 * FastMath.PI / 12, 150, 150, 0, 0);
    Assert.assertEquals(0, (roTestCase - myRo) / roTestCase, 1e-14);
    Assert.assertEquals(0, (tzTestCase - atm.getT()) / tzTestCase, 1e-13);
    Assert.assertEquals(0, (tinfTestCase - atm.getTinf()) / tinfTestCase, 1e-13);

    //      alt=500.
    //      lat=-70.      NB: the subroutine requires latitude in rad
    //      day=15.
    //      hl=16.        NB: the subroutine requires local time in rad (0hr=0 rad)
    //      xlon=0.
    //      fm(1)=70.
    //      f(1) =fm(1)
    //      fm(2)=0.
    //      f(2)=0.
    //      akp(1)=0.
    //      akp(2)=0.
    //      akp(3)=0.
    //      akp(4)=0.
    //      ro=    1.3150282384722D-16
    //      tz=    793.65487014559
    //      tinf=    793.65549802348
    //        roTestCase =    1.3150282384722E-16;
    //        tzTestCase=    793.65487014559;
    //        tinfTestCase=    793.65549802348;

    atm.getDensity(15, 500 * 1000, 0, FastMath.toRadians(-70), 16 * FastMath.PI / 12, 70, 70, 0, 0);

    //      IDEM., alt=800.
    //      ro=    1.9556768571305D-18
    //      tz=    793.65549797919
    //      tinf=    793.65549802348
    atm.getDensity(15, 800 * 1000, 0, FastMath.toRadians(-70), 16 * FastMath.PI / 12, 70, 70, 0, 0);
  }