Ejemplo n.º 1
0
 @Test
 public void testNewFormatNominal() throws OrekitException, ParseException {
   setRoot("new-bulletinB");
   IERSConventions.NutationCorrectionConverter converter =
       IERSConventions.IERS_2010.getNutationCorrectionConverter();
   SortedSet<EOPEntry> data = new TreeSet<EOPEntry>(new ChronologicalComparator());
   new BulletinBFilesLoader("bulletinb.270").fillHistory(converter, data);
   EOPHistory history = new EOPHistory(IERSConventions.IERS_2010, data, true);
   Assert.assertEquals(
       new AbsoluteDate(2010, 6, 2, TimeScalesFactory.getUTC()), history.getStartDate());
   Assert.assertEquals(
       new AbsoluteDate(2010, 7, 1, TimeScalesFactory.getUTC()), history.getEndDate());
 }
Ejemplo n.º 2
0
 @Test
 public void testNewFormatContent() throws OrekitException, ParseException {
   setRoot("new-bulletinB");
   IERSConventions.NutationCorrectionConverter converter =
       IERSConventions.IERS_2010.getNutationCorrectionConverter();
   SortedSet<EOPEntry> data = new TreeSet<EOPEntry>(new ChronologicalComparator());
   new BulletinBFilesLoader("bulletinb.270").fillHistory(converter, data);
   EOPHistory history = new EOPHistory(IERSConventions.IERS_2010, data, true);
   AbsoluteDate date = new AbsoluteDate(2010, 6, 12, 12, 0, 0, TimeScalesFactory.getUTC());
   Assert.assertEquals(
       msToS((-3 * 0.1202 + 27 * 0.0294 + 27 * 0.0682 - 3 * 0.1531) / 48),
       history.getLOD(date),
       1.0e-10);
   Assert.assertEquals(
       msToS((-3 * -57.1711 + 27 * -57.2523 + 27 * -57.3103 - 3 * -57.4101) / 48),
       history.getUT1MinusUTC(date),
       1.0e-10);
   Assert.assertEquals(
       masToRad((-3 * -1.216 + 27 * 1.658 + 27 * 4.926 - 3 * 7.789) / 48),
       history.getPoleCorrection(date).getXp(),
       1.0e-10);
   Assert.assertEquals(
       masToRad((-3 * 467.780 + 27 * 469.330 + 27 * 470.931 - 3 * 472.388) / 48),
       history.getPoleCorrection(date).getYp(),
       1.0e-10);
   Assert.assertEquals(
       masToRad((-3 * 0.097 + 27 * 0.089 + 27 * 0.050 - 3 * -0.007) / 48),
       history.getNonRotatinOriginNutationCorrection(date)[0],
       1.0e-10);
   Assert.assertEquals(
       masToRad((-3 * 0.071 + 27 * 0.066 + 27 * 0.090 - 3 * 0.111) / 48),
       history.getNonRotatinOriginNutationCorrection(date)[1],
       1.0e-10);
 }
Ejemplo n.º 3
0
 @Test
 public void testOldFormatContent() throws OrekitException, ParseException {
   setRoot("regular-data");
   IERSConventions.NutationCorrectionConverter converter =
       IERSConventions.IERS_2010.getNutationCorrectionConverter();
   SortedSet<EOPEntry> data = new TreeSet<EOPEntry>(new ChronologicalComparator());
   new BulletinBFilesLoader(FramesFactory.BULLETINB_2000_FILENAME).fillHistory(converter, data);
   EOPHistory history = new EOPHistory(IERSConventions.IERS_2010, data, true);
   AbsoluteDate date = new AbsoluteDate(2006, 1, 11, 12, 0, 0, TimeScalesFactory.getUTC());
   Assert.assertEquals(
       msToS((-3 * 0.073 + 27 * -0.130 + 27 * -0.244 - 3 * -0.264) / 48),
       history.getLOD(date),
       1.0e-10);
   Assert.assertEquals(
       (-3 * 0.333275 + 27 * 0.333310 + 27 * 0.333506 - 3 * 0.333768) / 48,
       history.getUT1MinusUTC(date),
       1.0e-10);
   Assert.assertEquals(
       asToRad((-3 * 0.04958 + 27 * 0.04927 + 27 * 0.04876 - 3 * 0.04854) / 48),
       history.getPoleCorrection(date).getXp(),
       1.0e-10);
   Assert.assertEquals(
       asToRad((-3 * 0.38117 + 27 * 0.38105 + 27 * 0.38071 - 3 * 0.38036) / 48),
       history.getPoleCorrection(date).getYp(),
       1.0e-10);
 }
Ejemplo n.º 4
0
  @Test
  public void testEventDetectionBug() throws OrekitException, IOException, ParseException {

    TimeScale utc = TimeScalesFactory.getUTC();
    AbsoluteDate initialDate = new AbsoluteDate(2005, 1, 1, 0, 0, 0.0, utc);
    double duration = 100000.;
    AbsoluteDate endDate = new AbsoluteDate(initialDate, duration);

    // Initialization of the frame EME2000
    Frame EME2000 = FramesFactory.getEME2000();

    // Initial orbit
    double a = 35786000. + 6378137.0;
    double e = 0.70;
    double rApogee = a * (1 + e);
    double vApogee = FastMath.sqrt(mu * (1 - e) / (a * (1 + e)));
    Orbit geo =
        new CartesianOrbit(
            new PVCoordinates(new Vector3D(rApogee, 0., 0.), new Vector3D(0., vApogee, 0.)),
            EME2000,
            initialDate,
            mu);

    duration = geo.getKeplerianPeriod();
    endDate = new AbsoluteDate(initialDate, duration);

    // Numerical Integration
    final double minStep = 0.001;
    final double maxStep = 1000;
    final double initStep = 60;
    final double[] absTolerance = {0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001};
    final double[] relTolerance = {1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7};

    AdaptiveStepsizeIntegrator integrator =
        new DormandPrince853Integrator(minStep, maxStep, absTolerance, relTolerance);
    integrator.setInitialStepSize(initStep);

    // Numerical propagator based on the integrator
    propagator = new NumericalPropagator(integrator);
    double mass = 1000.;
    SpacecraftState initialState = new SpacecraftState(geo, mass);
    propagator.setInitialState(initialState);
    propagator.setOrbitType(OrbitType.CARTESIAN);

    // Set the events Detectors
    ApsideDetector event1 = new ApsideDetector(geo);
    propagator.addEventDetector(event1);

    // Set the propagation mode
    propagator.setSlaveMode();

    // Propagate
    SpacecraftState finalState = propagator.propagate(endDate);

    // we should stop long before endDate
    Assert.assertTrue(endDate.durationFrom(finalState.getDate()) > 40000.0);
  }
Ejemplo n.º 5
0
  @Test
  public void testSpin() throws OrekitException {

    AbsoluteDate date =
        new AbsoluteDate(
            new DateComponents(1970, 01, 01),
            new TimeComponents(3, 25, 45.6789),
            TimeScalesFactory.getUTC());
    KeplerianOrbit orbit =
        new KeplerianOrbit(
            7178000.0,
            1.e-4,
            FastMath.toRadians(50.),
            FastMath.toRadians(10.),
            FastMath.toRadians(20.),
            FastMath.toRadians(30.),
            PositionAngle.MEAN,
            FramesFactory.getEME2000(),
            date,
            3.986004415e14);

    final AttitudeProvider law =
        new LofOffsetPointing(
            earthSpheric,
            new LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.XYX, 0.1, 0.2, 0.3),
            Vector3D.PLUS_K);

    Propagator propagator = new KeplerianPropagator(orbit, law);

    double h = 0.01;
    SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
    SpacecraftState s0 = propagator.propagate(date);
    SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));

    // check spin is consistent with attitude evolution
    double errorAngleMinus =
        Rotation.distance(
            sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
    double evolutionAngleMinus =
        Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAngleMinus, 1.0e-6 * evolutionAngleMinus);
    double errorAnglePlus =
        Rotation.distance(
            s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
    double evolutionAnglePlus =
        Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAnglePlus, 1.0e-6 * evolutionAnglePlus);

    Vector3D spin0 = s0.getAttitude().getSpin();
    Vector3D reference =
        AngularCoordinates.estimateRate(
            sMinus.getAttitude().getRotation(), sPlus.getAttitude().getRotation(), 2 * h);
    Assert.assertTrue(spin0.getNorm() > 1.0e-3);
    Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 1.0e-10);
  }
Ejemplo n.º 6
0
 @Test
 public void testStartDate() throws OrekitException, ParseException {
   setRoot("regular-data");
   IERSConventions.NutationCorrectionConverter converter =
       IERSConventions.IERS_2010.getNutationCorrectionConverter();
   SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
   new BulletinBFilesLoader(FramesFactory.BULLETINB_2000_FILENAME).fillHistory(converter, history);
   Assert.assertEquals(
       new AbsoluteDate(2005, 12, 5, TimeScalesFactory.getUTC()),
       new EOPHistory(IERSConventions.IERS_2010, history, true).getStartDate());
 }
 @Test
 public void testEndDateFinals1980() throws OrekitException {
   setRoot("compressed-data");
   IERSConventions.NutationCorrectionConverter converter =
       IERSConventions.IERS_1996.getNutationCorrectionConverter();
   SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
   new RapidDataAndPredictionXMLLoader("^finals\\.1999\\.xml$").fillHistory(converter, history);
   Assert.assertEquals(
       new AbsoluteDate(1999, 12, 31, TimeScalesFactory.getUTC()),
       new EOPHistory(IERSConventions.IERS_1996, history, true).getEndDate());
 }
 @Test
 public void testEndDateDaily2000() throws OrekitException {
   setRoot("rapid-data-xml");
   IERSConventions.NutationCorrectionConverter converter =
       IERSConventions.IERS_2003.getNutationCorrectionConverter();
   SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
   new RapidDataAndPredictionXMLLoader("^finals2000A\\.daily\\.xml$")
       .fillHistory(converter, history);
   Assert.assertEquals(
       new AbsoluteDate(2010, 7, 24, TimeScalesFactory.getUTC()),
       Collections.max(history, COMP).getDate());
 }
 @Test
 public void testStartDateFinals2000() throws OrekitException {
   setRoot("regular-data");
   IERSConventions.NutationCorrectionConverter converter =
       IERSConventions.IERS_2003.getNutationCorrectionConverter();
   SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
   new RapidDataAndPredictionXMLLoader("^finals2000A\\.2002\\.xml$")
       .fillHistory(converter, history);
   Assert.assertEquals(
       new AbsoluteDate(2002, 1, 1, TimeScalesFactory.getUTC()),
       new EOPHistory(IERSConventions.IERS_2003, history, true).getStartDate());
 }
Ejemplo n.º 10
0
 @Test
 public void testIssue141() throws OrekitException {
   AbsoluteDate date =
       new AbsoluteDate("2002-03-06T20:50:20.44188731559965033", TimeScalesFactory.getUTC());
   Frame frame = FramesFactory.getGTOD(IERSConventions.IERS_1996, true);
   OneAxisEllipsoid model =
       new OneAxisEllipsoid(
           Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, frame);
   Vector3D point = new Vector3D(-6838696.282102453, -2148321.403361013, -0.011907944179711194);
   GeodeticPoint gp = model.transform(point, frame, date);
   Vector3D rebuilt = model.transform(gp);
   Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-15 * point.getNorm());
 }
Ejemplo n.º 11
0
 public static List<EOPEntry> buildEOPList(IERSConventions conventions, double[][] data)
     throws OrekitException {
   IERSConventions.NutationCorrectionConverter converter =
       conventions.getNutationCorrectionConverter();
   final List<EOPEntry> list = new ArrayList<EOPEntry>();
   for (double[] row : data) {
     final AbsoluteDate date =
         new AbsoluteDate(
             new DateComponents(DateComponents.MODIFIED_JULIAN_EPOCH, (int) row[0]),
             TimeScalesFactory.getUTC());
     final double[] nro;
     final double[] equinox;
     if (Double.isNaN(row[7])) {
       equinox =
           new double[] {
             Constants.ARC_SECONDS_TO_RADIANS * row[5], Constants.ARC_SECONDS_TO_RADIANS * row[6]
           };
       nro = converter.toNonRotating(date, equinox[0], equinox[1]);
     } else if (Double.isNaN(row[5])) {
       nro =
           new double[] {
             Constants.ARC_SECONDS_TO_RADIANS * row[7], Constants.ARC_SECONDS_TO_RADIANS * row[8]
           };
       equinox = converter.toEquinox(date, nro[0], nro[1]);
     } else {
       equinox =
           new double[] {
             Constants.ARC_SECONDS_TO_RADIANS * row[5], Constants.ARC_SECONDS_TO_RADIANS * row[6]
           };
       nro =
           new double[] {
             Constants.ARC_SECONDS_TO_RADIANS * row[7], Constants.ARC_SECONDS_TO_RADIANS * row[8]
           };
     }
     list.add(
         new EOPEntry(
             (int) row[0],
             row[1],
             row[2],
             Constants.ARC_SECONDS_TO_RADIANS * row[3],
             Constants.ARC_SECONDS_TO_RADIANS * row[4],
             equinox[0],
             equinox[1],
             nro[0],
             nro[1]));
   }
   return list;
 }
Ejemplo n.º 12
0
  @Test
  public void testFrance() throws OrekitException {

    final BodyShape earth =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, true));

    GeographicZoneDetector d =
        new GeographicZoneDetector(20.0, 1.e-3, earth, buildFrance(), FastMath.toRadians(0.5))
            .withHandler(new ContinueOnEvent<GeographicZoneDetector>());

    Assert.assertEquals(20.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-3, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(0.5, FastMath.toDegrees(d.getMargin()), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());

    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit =
        new EquinoctialOrbit(
            new PVCoordinates(position, velocity),
            FramesFactory.getEME2000(),
            date,
            Constants.EIGEN5C_EARTH_MU);

    Propagator propagator =
        new EcksteinHechlerPropagator(
            orbit,
            Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS,
            Constants.EIGEN5C_EARTH_MU,
            Constants.EIGEN5C_EARTH_C20,
            Constants.EIGEN5C_EARTH_C30,
            Constants.EIGEN5C_EARTH_C40,
            Constants.EIGEN5C_EARTH_C50,
            Constants.EIGEN5C_EARTH_C60);

    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));

    propagator.propagate(date.shiftedBy(10 * Constants.JULIAN_DAY));
    Assert.assertEquals(26, logger.getLoggedEvents().size());
  }
Ejemplo n.º 13
0
  @Test
  public void testWMMWithHeightAboveMSL() throws Exception {
    // test results for test values provided as part of the WMM2015 Report
    // using height above MSL instead of height above ellipsoid
    // the results have been obtained from the NOAA online calculator:
    // http://www.ngdc.noaa.gov/geomag-web/#igrfwmm
    final double[][] testValues = {
      // Date  Alt  Lat  Lon        X        Y         Z        H        F       I      D
      //        km  deg  deg       nT       nT        nT       nT       nT     deg    deg
      {2015.0, 100, 80, 0, 6314.2, -471.6, 52269.1, 6331.8, 52651.2, 83.093, -4.271},
      {2015.0, 100, 0, 120, 37534.4, 364.3, -10773.1, 37536.2, 39051.6, -16.013, 0.556},
      {2015.0, 100, -80, 240, 5613.2, 14791.9, -50379.6, 15821.1, 52805.4, -72.565, 69.219}
    };

    final Geoid geoid = new Geoid(potential, WGS84);

    final double eps = 1e-1;
    final double degreeEps = 1e-2;
    for (int i = 0; i < testValues.length; i++) {
      final AbsoluteDate date = new AbsoluteDate(2015, 1, 1, TimeScalesFactory.getUTC());
      final GeoMagneticField model = GeoMagneticFieldFactory.getWMM(testValues[i][0]);
      final double undulation =
          geoid.getUndulation(
              FastMath.toRadians(testValues[i][2]), FastMath.toRadians(testValues[i][3]), date);
      final GeoMagneticElements result =
          model.calculateField(
              testValues[i][2], testValues[i][3], testValues[i][1] + undulation / 1000d);

      // X
      Assert.assertEquals(testValues[i][4], result.getFieldVector().getX(), eps);
      // Y
      Assert.assertEquals(testValues[i][5], result.getFieldVector().getY(), eps);
      // Z
      Assert.assertEquals(testValues[i][6], result.getFieldVector().getZ(), eps);
      // H
      Assert.assertEquals(testValues[i][7], result.getHorizontalIntensity(), eps);
      // F
      Assert.assertEquals(testValues[i][8], result.getTotalIntensity(), eps);
      // inclination
      Assert.assertEquals(testValues[i][9], result.getInclination(), degreeEps);
      // declination
      Assert.assertEquals(testValues[i][10], result.getDeclination(), degreeEps);
    }
  }
  /* (non-Javadoc)
   * @see org.orekit.propagation.sampling.OrekitFixedStepHandler#handleStep(org.orekit.propagation.SpacecraftState, boolean)
   */
  public void handleStep(SpacecraftState currentState, boolean isLast) throws PropagationException {

    /** Create position vector. */
    D3Vector position =
        new D3Vector(
            "",
            "Position",
            "Position",
            "The orbital position of the satellite at the given time.",
            currentState.getOrbit().getPVCoordinates().getPosition().getX(),
            currentState.getOrbit().getPVCoordinates().getPosition().getY(),
            currentState.getOrbit().getPVCoordinates().getPosition().getZ());

    /** Create velocity vector. */
    D3Vector velocity =
        new D3Vector(
            "",
            "Velocity",
            "Velocity",
            "The orbital velocity of the satellite at the given time",
            currentState.getOrbit().getPVCoordinates().getVelocity().getX(),
            currentState.getOrbit().getPVCoordinates().getVelocity().getY(),
            currentState.getOrbit().getPVCoordinates().getVelocity().getZ());

    try {
      /** Create orbital state. */
      OrbitalState state =
          new OrbitalState(
              predictor.name,
              orbitalStateName,
              orbitalStateDescription,
              currentState.getDate().toDate(TimeScalesFactory.getUTC()).getTime(),
              datasetidentifier,
              satellite,
              position,
              velocity);

      /** Send the orbital state on the response stream. */
      predictor.addResult(state);
    } catch (OrekitException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 15
0
 @Test
 public void testIssue157() throws OrekitException {
   try {
     Orbit orbit =
         new KeplerianOrbit(
             13378000,
             0.05,
             0,
             0,
             FastMath.PI,
             0,
             PositionAngle.MEAN,
             FramesFactory.getTOD(false),
             new AbsoluteDate(2003, 5, 6, TimeScalesFactory.getUTC()),
             Constants.EIGEN5C_EARTH_MU);
     NumericalPropagator.tolerances(1.0, orbit, OrbitType.KEPLERIAN);
     Assert.fail("an exception should have been thrown");
   } catch (PropagationException pe) {
     Assert.assertEquals(OrekitMessages.SINGULAR_JACOBIAN_FOR_ORBIT_TYPE, pe.getSpecifier());
   }
 }
  @Before
  public void setUp() throws OrekitException {

    Utils.setDataRoot("regular-data");
    earth =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, true));

    gp = new GeodeticPoint(FastMath.toRadians(51.0), FastMath.toRadians(66.6), 300.0);
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    orbit =
        new EquinoctialOrbit(
            new PVCoordinates(position, velocity),
            FramesFactory.getEME2000(),
            date,
            Constants.EIGEN5C_EARTH_MU);
  }
Ejemplo n.º 17
0
  @Before
  public void setUp() {
    try {

      Utils.setDataRoot("regular-data");

      // Computation date
      date =
          new AbsoluteDate(
              new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());

      // Body mu
      mu = 3.9860047e14;

      // Reference frame = ITRF
      frameItrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);

      // Elliptic earth shape
      earthSpheric = new OneAxisEllipsoid(6378136.460, 0., frameItrf);

    } catch (OrekitException oe) {
      Assert.fail(oe.getMessage());
    }
  }
Ejemplo n.º 18
0
  @Test
  public void testIntersectionFromPoints() throws OrekitException {
    AbsoluteDate date =
        new AbsoluteDate(
            new DateComponents(2008, 03, 21), TimeComponents.H12, TimeScalesFactory.getUTC());

    Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, frame);

    // Satellite on polar position
    // ***************************
    final double mu = 3.9860047e14;
    CircularOrbit circ =
        new CircularOrbit(
            7178000.0,
            0.5e-4,
            0.,
            FastMath.toRadians(90.),
            FastMath.toRadians(60.),
            FastMath.toRadians(90.),
            PositionAngle.MEAN,
            FramesFactory.getEME2000(),
            date,
            mu);

    // Transform satellite position to position/velocity parameters in EME2000 and ITRF200B
    PVCoordinates pvSatEME2000 = circ.getPVCoordinates();
    PVCoordinates pvSatItrf =
        frame.getTransformTo(FramesFactory.getEME2000(), date).transformPVCoordinates(pvSatEME2000);
    Vector3D pSatItrf = pvSatItrf.getPosition();

    // Test first visible surface points
    GeodeticPoint geoPoint =
        new GeodeticPoint(FastMath.toRadians(70.), FastMath.toRadians(60.), 0.);
    Vector3D pointItrf = earth.transform(geoPoint);
    Line line = new Line(pSatItrf, pointItrf, 1.0e-10);
    GeodeticPoint geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);
    Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle);

    // Test second visible surface points
    geoPoint = new GeodeticPoint(FastMath.toRadians(65.), FastMath.toRadians(-120.), 0.);
    pointItrf = earth.transform(geoPoint);
    line = new Line(pSatItrf, pointItrf, 1.0e-10);
    geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);
    Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle);

    // Test non visible surface points
    geoPoint = new GeodeticPoint(FastMath.toRadians(30.), FastMath.toRadians(60.), 0.);
    pointItrf = earth.transform(geoPoint);
    line = new Line(pSatItrf, pointItrf, 1.0e-10);

    geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);

    // For polar satellite position, intersection point is at the same longitude but different
    // latitude
    Assert.assertEquals(1.04437199, geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(1.36198012, geoInter.getLatitude(), Utils.epsilonAngle);

    // Satellite on equatorial position
    // ********************************
    circ =
        new CircularOrbit(
            7178000.0,
            0.5e-4,
            0.,
            FastMath.toRadians(1.e-4),
            FastMath.toRadians(0.),
            FastMath.toRadians(0.),
            PositionAngle.MEAN,
            FramesFactory.getEME2000(),
            date,
            mu);

    // Transform satellite position to position/velocity parameters in EME2000 and ITRF200B
    pvSatEME2000 = circ.getPVCoordinates();
    pvSatItrf =
        frame.getTransformTo(FramesFactory.getEME2000(), date).transformPVCoordinates(pvSatEME2000);
    pSatItrf = pvSatItrf.getPosition();

    // Test first visible surface points
    geoPoint = new GeodeticPoint(FastMath.toRadians(5.), FastMath.toRadians(0.), 0.);
    pointItrf = earth.transform(geoPoint);
    line = new Line(pSatItrf, pointItrf, 1.0e-10);
    Assert.assertTrue(line.toSubSpace(pSatItrf).getX() < 0);
    geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);
    Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle);

    // With the point opposite to satellite point along the line
    GeodeticPoint geoInter2 =
        earth.getIntersectionPoint(
            line, line.toSpace(new Vector1D(-line.toSubSpace(pSatItrf).getX())), frame, date);
    Assert.assertTrue(
        FastMath.abs(geoInter.getLongitude() - geoInter2.getLongitude()) > FastMath.toRadians(0.1));
    Assert.assertTrue(
        FastMath.abs(geoInter.getLatitude() - geoInter2.getLatitude()) > FastMath.toRadians(0.1));

    // Test second visible surface points
    geoPoint = new GeodeticPoint(FastMath.toRadians(-5.), FastMath.toRadians(0.), 0.);
    pointItrf = earth.transform(geoPoint);
    line = new Line(pSatItrf, pointItrf, 1.0e-10);
    geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);
    Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle);

    // Test non visible surface points
    geoPoint = new GeodeticPoint(FastMath.toRadians(40.), FastMath.toRadians(0.), 0.);
    pointItrf = earth.transform(geoPoint);
    line = new Line(pSatItrf, pointItrf, 1.0e-10);
    geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);
    Assert.assertEquals(-0.00768481, geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(0.32180410, geoInter.getLatitude(), Utils.epsilonAngle);

    // Satellite on any position
    // *************************
    circ =
        new CircularOrbit(
            7178000.0,
            0.5e-4,
            0.,
            FastMath.toRadians(50.),
            FastMath.toRadians(0.),
            FastMath.toRadians(90.),
            PositionAngle.MEAN,
            FramesFactory.getEME2000(),
            date,
            mu);

    // Transform satellite position to position/velocity parameters in EME2000 and ITRF200B
    pvSatEME2000 = circ.getPVCoordinates();
    pvSatItrf =
        frame.getTransformTo(FramesFactory.getEME2000(), date).transformPVCoordinates(pvSatEME2000);
    pSatItrf = pvSatItrf.getPosition();

    // Test first visible surface points
    geoPoint = new GeodeticPoint(FastMath.toRadians(40.), FastMath.toRadians(90.), 0.);
    pointItrf = earth.transform(geoPoint);
    line = new Line(pSatItrf, pointItrf, 1.0e-10);
    geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);
    Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle);

    // Test second visible surface points
    geoPoint = new GeodeticPoint(FastMath.toRadians(60.), FastMath.toRadians(90.), 0.);
    pointItrf = earth.transform(geoPoint);
    line = new Line(pSatItrf, pointItrf, 1.0e-10);
    geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);
    Assert.assertEquals(geoPoint.getLongitude(), geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(geoPoint.getLatitude(), geoInter.getLatitude(), Utils.epsilonAngle);

    // Test non visible surface points
    geoPoint = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(90.), 0.);
    pointItrf = earth.transform(geoPoint);
    line = new Line(pSatItrf, pointItrf, 1.0e-10);
    geoInter = earth.getIntersectionPoint(line, pSatItrf, frame, date);
    Assert.assertEquals(
        FastMath.toRadians(89.5364061088196), geoInter.getLongitude(), Utils.epsilonAngle);
    Assert.assertEquals(
        FastMath.toRadians(35.555543683351125), geoInter.getLatitude(), Utils.epsilonAngle);
  }
Ejemplo n.º 19
0
  @Test
  public void testJacobianIssue18() throws OrekitException {

    // Body mu
    final double mu = 3.9860047e14;

    final double isp = 318;
    final double mass = 2500;
    final double a = 24396159;
    final double e = 0.72831215;
    final double i = FastMath.toRadians(7);
    final double omega = FastMath.toRadians(180);
    final double OMEGA = FastMath.toRadians(261);
    final double lv = 0;

    final double duration = 3653.99;
    final double f = 420;
    final double delta = FastMath.toRadians(-7.4978);
    final double alpha = FastMath.toRadians(351);
    final AttitudeProvider law =
        new InertialProvider(new Rotation(new Vector3D(alpha, delta), Vector3D.PLUS_I));

    final AbsoluteDate initDate =
        new AbsoluteDate(
            new DateComponents(2004, 01, 01),
            new TimeComponents(23, 30, 00.000),
            TimeScalesFactory.getUTC());
    final Orbit orbit =
        new KeplerianOrbit(
            a,
            e,
            i,
            omega,
            OMEGA,
            lv,
            PositionAngle.TRUE,
            FramesFactory.getEME2000(),
            initDate,
            mu);
    final SpacecraftState initialState =
        new SpacecraftState(orbit, law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);

    final AbsoluteDate fireDate =
        new AbsoluteDate(
            new DateComponents(2004, 01, 02),
            new TimeComponents(04, 15, 34.080),
            TimeScalesFactory.getUTC());
    final ConstantThrustManeuver maneuver =
        new ConstantThrustManeuver(fireDate, duration, f, isp, Vector3D.PLUS_I);

    double[] absTolerance = {0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001};
    double[] relTolerance = {1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7};
    AdaptiveStepsizeIntegrator integrator =
        new DormandPrince853Integrator(0.001, 1000, absTolerance, relTolerance);
    integrator.setInitialStepSize(60);
    final NumericalPropagator propagator = new NumericalPropagator(integrator);

    propagator.setAttitudeProvider(law);
    propagator.addForceModel(maneuver);

    propagator.setOrbitType(OrbitType.CARTESIAN);
    PartialDerivativesEquations PDE = new PartialDerivativesEquations("derivatives", propagator);
    PDE.selectParamAndStep("thrust", Double.NaN);
    Assert.assertEquals(3, PDE.getAvailableParameters().size());
    Assert.assertEquals("central attraction coefficient", PDE.getAvailableParameters().get(0));
    Assert.assertEquals("thrust", PDE.getAvailableParameters().get(1));
    Assert.assertEquals("flow rate", PDE.getAvailableParameters().get(2));
    propagator.setInitialState(PDE.setInitialJacobians(initialState, 7, 1));

    final AbsoluteDate finalDate = fireDate.shiftedBy(3800);
    final SpacecraftState finalorb = propagator.propagate(finalDate);
    Assert.assertEquals(0, finalDate.durationFrom(finalorb.getDate()), 1.0e-11);
  }