Esempio n. 1
0
  @Test
  public void testGroundToGroundIssue181() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV =
        new TimeStampedPVCoordinates(
            AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.),
            new Vector3D(6414.7, -2006., -3180.),
            Vector3D.ZERO);
    TimeStampedPVCoordinates body =
        itrf.getTransformTo(eme2000, initPV.getDate()).transformPVCoordinates(initPV);
    TimeStampedPVCoordinates ground1 = model.projectToGround(body, itrf);
    TimeStampedPVCoordinates ground2 = model.projectToGround(ground1, itrf);
    Assert.assertEquals(
        0.0, Vector3D.distance(ground1.getPosition(), ground2.getPosition()), 1.0e-12);
    Assert.assertEquals(
        0.0, Vector3D.distance(ground1.getVelocity(), ground2.getVelocity()), 1.0e-12);
    Assert.assertEquals(
        0.0, Vector3D.distance(ground1.getAcceleration(), ground2.getAcceleration()), 1.0e-12);
  }
Esempio n. 2
0
  private static List<GeodeticPoint> computeCircle(
      double latitude,
      double longitude,
      double altitude,
      String name,
      double minElevation,
      double radius,
      int points)
      throws OrekitException {

    // define Earth shape, using WGS84 model
    BodyShape earth =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, false));

    // define an array of ground stations
    TopocentricFrame station =
        new TopocentricFrame(earth, new GeodeticPoint(latitude, longitude, altitude), name);

    // compute the visibility circle
    List<GeodeticPoint> circle = new ArrayList<GeodeticPoint>();
    for (int i = 0; i < points; ++i) {
      double azimuth = i * (2.0 * FastMath.PI / points);
      circle.add(station.computeLimitVisibilityPoint(radius, azimuth, minElevation));
    }

    // return the computed points
    return circle;
  }
Esempio n. 3
0
 @Test
 public void testNoLineIntersection() throws OrekitException {
   AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
   Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
   OneAxisEllipsoid model = new OneAxisEllipsoid(100.0, 0.9, frame);
   Vector3D point = new Vector3D(0.0, 93.7139699, 3.5930796);
   Vector3D direction = new Vector3D(0.0, 9.0, -2.0);
   Line line = new Line(point, point.add(direction), 1.0e-10);
   Assert.assertNull(model.getIntersectionPoint(line, point, frame, date));
 }
Esempio n. 4
0
 @Test
 public void testFarPoint() throws OrekitException {
   AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
   Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
   OneAxisEllipsoid model = new OneAxisEllipsoid(90.0, 5.0 / 9.0, frame);
   Vector3D point = new Vector3D(1.0e15, 2.0e15, -1.0e12);
   GeodeticPoint gp = model.transform(point, frame, date);
   Vector3D rebuilt = model.transform(gp);
   Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-15 * point.getNorm());
 }
Esempio n. 5
0
 @Test
 public void testGeoCar() throws OrekitException {
   OneAxisEllipsoid model =
       new OneAxisEllipsoid(
           6378137.0, 1.0 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
   GeodeticPoint nsp = new GeodeticPoint(0.852479154923577, 0.0423149994747243, 111.6);
   Vector3D p = model.transform(nsp);
   Assert.assertEquals(4201866.69291890, p.getX(), 1.0e-6);
   Assert.assertEquals(177908.184625686, p.getY(), 1.0e-6);
   Assert.assertEquals(4779203.64408617, p.getZ(), 1.0e-6);
 }
Esempio n. 6
0
 @Test
 public void testOnSurface() throws OrekitException {
   Vector3D surfacePoint =
       new Vector3D(-1092200.775949484, -3944945.7282234835, 4874931.946956173);
   OneAxisEllipsoid earthShape =
       new OneAxisEllipsoid(
           6378136.460, 1 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
   GeodeticPoint gp =
       earthShape.transform(surfacePoint, earthShape.getBodyFrame(), AbsoluteDate.J2000_EPOCH);
   Vector3D rebuilt = earthShape.transform(gp);
   Assert.assertEquals(0, rebuilt.distance(surfacePoint), 3.0e-9);
 }
Esempio n. 7
0
 @Test
 public void testEquatorialInside() throws OrekitException {
   AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
   Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
   OneAxisEllipsoid model = new OneAxisEllipsoid(90.0, 5.0 / 9.0, frame);
   for (double rho = 0; rho < model.getEquatorialRadius(); rho += 0.01) {
     Vector3D point = new Vector3D(rho, 0.0, 0.0);
     GeodeticPoint gp = model.transform(point, frame, date);
     Vector3D rebuilt = model.transform(gp);
     Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-10);
   }
 }
  @Test
  public void testPropagationTypesHyperbolic() throws OrekitException, ParseException, IOException {

    SpacecraftState state =
        new SpacecraftState(
            new KeplerianOrbit(
                -10000000.0,
                2.5,
                0.3,
                0,
                0,
                0.0,
                PositionAngle.TRUE,
                FramesFactory.getEME2000(),
                initDate,
                mu));

    ForceModel gravityField =
        new HolmesFeatherstoneAttractionModel(
            FramesFactory.getITRF(IERSConventions.IERS_2010, true),
            GravityFieldFactory.getNormalizedProvider(5, 5));
    propagator.addForceModel(gravityField);

    // Propagation of the initial at t + dt
    final PVCoordinates pv = state.getPVCoordinates();
    final double dP = 0.001;
    final double dV =
        state.getMu() * dP / (pv.getPosition().getNormSq() * pv.getVelocity().getNorm());

    final PVCoordinates pvcM = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.MEAN);
    final PVCoordinates pvkM = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.MEAN);

    final PVCoordinates pvcE =
        propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.ECCENTRIC);
    final PVCoordinates pvkE =
        propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.ECCENTRIC);

    final PVCoordinates pvcT = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.TRUE);
    final PVCoordinates pvkT = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.TRUE);

    Assert.assertEquals(0, pvcM.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcM.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
    Assert.assertEquals(0, pvkM.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.2);
    Assert.assertEquals(0, pvkM.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.3);

    Assert.assertEquals(0, pvcE.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcE.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
    Assert.assertEquals(0, pvkE.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.009);
    Assert.assertEquals(0, pvkE.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.006);

    Assert.assertEquals(0, pvcT.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcT.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
  }
Esempio n. 9
0
  @Test
  public void testLineIntersection() throws OrekitException {
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);

    OneAxisEllipsoid model = new OneAxisEllipsoid(100.0, 0.9, frame);
    Vector3D point = new Vector3D(0.0, 93.7139699, 3.5930796);
    Vector3D direction = new Vector3D(0.0, 1.0, 1.0);
    Line line = new Line(point, point.add(direction), 1.0e-10);
    GeodeticPoint gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertEquals(gp.getAltitude(), 0.0, 1.0e-12);
    Assert.assertTrue(line.contains(model.transform(gp)));

    model = new OneAxisEllipsoid(100.0, 0.9, frame);
    point = new Vector3D(0.0, -93.7139699, -3.5930796);
    direction = new Vector3D(0.0, -1.0, -1.0);
    line = new Line(point, point.add(direction), 1.0e-10).revert();
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertTrue(line.contains(model.transform(gp)));

    model = new OneAxisEllipsoid(100.0, 0.9, frame);
    point = new Vector3D(0.0, -93.7139699, 3.5930796);
    direction = new Vector3D(0.0, -1.0, 1.0);
    line = new Line(point, point.add(direction), 1.0e-10);
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertTrue(line.contains(model.transform(gp)));

    model = new OneAxisEllipsoid(100.0, 0.9, frame);
    point = new Vector3D(-93.7139699, 0.0, 3.5930796);
    direction = new Vector3D(-1.0, 0.0, 1.0);
    line = new Line(point, point.add(direction), 1.0e-10);
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertTrue(line.contains(model.transform(gp)));
    Assert.assertFalse(line.contains(new Vector3D(0, 0, 7000000)));

    point = new Vector3D(0.0, 0.0, 110);
    direction = new Vector3D(0.0, 0.0, 1.0);
    line = new Line(point, point.add(direction), 1.0e-10);
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertEquals(gp.getLatitude(), FastMath.PI / 2, 1.0e-12);

    point = new Vector3D(0.0, 110, 0);
    direction = new Vector3D(0.0, 1.0, 0.0);
    line = new Line(point, point.add(direction), 1.0e-10);
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertEquals(gp.getLatitude(), 0, 1.0e-12);
  }
  @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());
  }
  @Test
  public void testSerialization()
      throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException,
          OrekitException {

    final double r = Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
    final BodyShape earth =
        new OneAxisEllipsoid(
            r,
            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))
            .withMargin(FastMath.toRadians(0.75))
            .withHandler(new ContinueOnEvent<GeographicZoneDetector>());

    Assert.assertEquals(r, ((OneAxisEllipsoid) d.getBody()).getEquatorialRadius(), 1.0e-12);
    Assert.assertEquals(0.75, FastMath.toDegrees(d.getMargin()), 1.0e-12);
    Assert.assertEquals(5.6807e11, d.getZone().getSize() * r * r, 1.0e9);
    Assert.assertEquals(4.0289e6, d.getZone().getBoundarySize() * r, 1.0e3);

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(d);

    Assert.assertTrue(bos.size() > 2100);
    Assert.assertTrue(bos.size() < 2200);

    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    GeographicZoneDetector deserialized = (GeographicZoneDetector) ois.readObject();

    Assert.assertEquals(d.getZone().getSize(), deserialized.getZone().getSize(), 1.0e-3);
    Assert.assertEquals(
        d.getZone().getBoundarySize(), deserialized.getZone().getBoundarySize(), 1.0e-3);
    Assert.assertEquals(d.getZone().getTolerance(), deserialized.getZone().getTolerance(), 1.0e-15);
    Assert.assertEquals(d.getMaxCheckInterval(), deserialized.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(d.getThreshold(), deserialized.getThreshold(), 1.0e-15);
    Assert.assertEquals(d.getMaxIterationCount(), deserialized.getMaxIterationCount());

    Assert.assertTrue(
        new RegionFactory<Sphere2D>().difference(d.getZone(), deserialized.getZone()).isEmpty());
  }
Esempio n. 12
0
  private void checkCartesianToEllipsoidic(
      double ae,
      double f,
      double x,
      double y,
      double z,
      double longitude,
      double latitude,
      double altitude)
      throws OrekitException {

    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    OneAxisEllipsoid model = new OneAxisEllipsoid(ae, f, frame);
    GeodeticPoint gp = model.transform(new Vector3D(x, y, z), frame, date);
    Assert.assertEquals(longitude, MathUtils.normalizeAngle(gp.getLongitude(), longitude), 1.0e-10);
    Assert.assertEquals(latitude, gp.getLatitude(), 1.0e-10);
    Assert.assertEquals(altitude, gp.getAltitude(), 1.0e-10 * FastMath.abs(ae));
    Vector3D rebuiltNadir = Vector3D.crossProduct(gp.getSouth(), gp.getWest());
    Assert.assertEquals(0, rebuiltNadir.subtract(gp.getNadir()).getNorm(), 1.0e-15);
  }
Esempio n. 13
0
  @Test
  public void testGroundProjectionDerivatives() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV =
        new TimeStampedPVCoordinates(
            AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.),
            new Vector3D(6414.7, -2006., -3180.),
            Vector3D.ZERO);
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    double[] errors = derivativesErrors(orbit, orbit.getDate(), eme2000, model);
    Assert.assertEquals(0, errors[0], 1.0e-16);
    Assert.assertEquals(0, errors[1], 1.0e-12);
    Assert.assertEquals(0, errors[2], 2.0e-4);
  }
  @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);
  }
Esempio n. 15
0
  @Test
  public void testGroundProjectionTaylor() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV =
        new TimeStampedPVCoordinates(
            AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.),
            new Vector3D(6414.7, -2006., -3180.),
            Vector3D.ZERO);
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    TimeStampedPVCoordinates pv0 = orbit.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
    PVCoordinatesProvider groundTaylor =
        model.projectToGround(pv0, model.getBodyFrame()).toTaylorProvider(model.getBodyFrame());

    TimeStampedPVCoordinates g0 =
        groundTaylor.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
    Vector3D zenith = pv0.getPosition().subtract(g0.getPosition()).normalize();
    Vector3D acrossTrack = Vector3D.crossProduct(zenith, g0.getVelocity()).normalize();
    Vector3D alongTrack = Vector3D.crossProduct(acrossTrack, zenith).normalize();
    for (double dt = -1; dt < 1; dt += 0.01) {
      AbsoluteDate date = orbit.getDate().shiftedBy(dt);
      Vector3D taylorP = groundTaylor.getPVCoordinates(date, model.getBodyFrame()).getPosition();
      Vector3D refP =
          model.projectToGround(
              orbit.getPVCoordinates(date, model.getBodyFrame()).getPosition(),
              date,
              model.getBodyFrame());
      Vector3D delta = taylorP.subtract(refP);
      Assert.assertEquals(0.0, Vector3D.dotProduct(delta, alongTrack), 0.0015);
      Assert.assertEquals(0.0, Vector3D.dotProduct(delta, acrossTrack), 0.0007);
      Assert.assertEquals(0.0, Vector3D.dotProduct(delta, zenith), 0.00002);
    }
  }
Esempio n. 16
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());
    }
  }
Esempio n. 17
0
  @Test
  public void testGroundProjectionPosition() throws OrekitException {
    OneAxisEllipsoid model =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, true));

    TimeStampedPVCoordinates initPV =
        new TimeStampedPVCoordinates(
            AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.),
            new Vector3D(6414.7, -2006., -3180.),
            Vector3D.ZERO);
    Frame eme2000 = FramesFactory.getEME2000();
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    for (double dt = 0; dt < 3600.0; dt += 60.0) {

      TimeStampedPVCoordinates pv = orbit.getPVCoordinates(orbit.getDate().shiftedBy(dt), eme2000);
      TimeStampedPVCoordinates groundPV = model.projectToGround(pv, eme2000);
      Vector3D groundP = model.projectToGround(pv.getPosition(), pv.getDate(), eme2000);

      // check methods projectToGround and transform are consistent with each other
      Assert.assertEquals(
          model.transform(pv.getPosition(), eme2000, pv.getDate()).getLatitude(),
          model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLatitude(),
          1.0e-10);
      Assert.assertEquals(
          model.transform(pv.getPosition(), eme2000, pv.getDate()).getLongitude(),
          model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLongitude(),
          1.0e-10);
      Assert.assertEquals(
          0.0, Vector3D.distance(groundP, groundPV.getPosition()), 1.0e-15 * groundP.getNorm());
    }
  }
Esempio n. 18
0
  @Test
  public void testPropagationTypesElliptical() throws OrekitException, ParseException, IOException {

    ForceModel gravityField =
        new HolmesFeatherstoneAttractionModel(
            FramesFactory.getITRF(IERSConventions.IERS_2010, true),
            GravityFieldFactory.getNormalizedProvider(5, 5));
    propagator.addForceModel(gravityField);

    // Propagation of the initial at t + dt
    final PVCoordinates pv = initialState.getPVCoordinates();
    final double dP = 0.001;
    final double dV =
        initialState.getMu() * dP / (pv.getPosition().getNormSq() * pv.getVelocity().getNorm());

    final PVCoordinates pvcM =
        propagateInType(initialState, dP, OrbitType.CARTESIAN, PositionAngle.MEAN);
    final PVCoordinates pviM =
        propagateInType(initialState, dP, OrbitType.CIRCULAR, PositionAngle.MEAN);
    final PVCoordinates pveM =
        propagateInType(initialState, dP, OrbitType.EQUINOCTIAL, PositionAngle.MEAN);
    final PVCoordinates pvkM =
        propagateInType(initialState, dP, OrbitType.KEPLERIAN, PositionAngle.MEAN);

    final PVCoordinates pvcE =
        propagateInType(initialState, dP, OrbitType.CARTESIAN, PositionAngle.ECCENTRIC);
    final PVCoordinates pviE =
        propagateInType(initialState, dP, OrbitType.CIRCULAR, PositionAngle.ECCENTRIC);
    final PVCoordinates pveE =
        propagateInType(initialState, dP, OrbitType.EQUINOCTIAL, PositionAngle.ECCENTRIC);
    final PVCoordinates pvkE =
        propagateInType(initialState, dP, OrbitType.KEPLERIAN, PositionAngle.ECCENTRIC);

    final PVCoordinates pvcT =
        propagateInType(initialState, dP, OrbitType.CARTESIAN, PositionAngle.TRUE);
    final PVCoordinates pviT =
        propagateInType(initialState, dP, OrbitType.CIRCULAR, PositionAngle.TRUE);
    final PVCoordinates pveT =
        propagateInType(initialState, dP, OrbitType.EQUINOCTIAL, PositionAngle.TRUE);
    final PVCoordinates pvkT =
        propagateInType(initialState, dP, OrbitType.KEPLERIAN, PositionAngle.TRUE);

    Assert.assertEquals(0, pvcM.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 3.0);
    Assert.assertEquals(0, pvcM.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 2.0);
    Assert.assertEquals(0, pviM.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 0.6);
    Assert.assertEquals(0, pviM.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 0.4);
    Assert.assertEquals(0, pvkM.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 0.5);
    Assert.assertEquals(0, pvkM.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 0.3);
    Assert.assertEquals(0, pveM.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 0.2);
    Assert.assertEquals(0, pveM.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 0.2);

    Assert.assertEquals(0, pvcE.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 3.0);
    Assert.assertEquals(0, pvcE.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 2.0);
    Assert.assertEquals(0, pviE.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 0.03);
    Assert.assertEquals(0, pviE.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 0.04);
    Assert.assertEquals(0, pvkE.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 0.4);
    Assert.assertEquals(0, pvkE.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 0.3);
    Assert.assertEquals(0, pveE.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 0.2);
    Assert.assertEquals(0, pveE.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 0.07);

    Assert.assertEquals(0, pvcT.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 3.0);
    Assert.assertEquals(0, pvcT.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 2.0);
    Assert.assertEquals(0, pviT.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pviT.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 0.2);
    Assert.assertEquals(0, pvkT.getPosition().subtract(pveT.getPosition()).getNorm() / dP, 0.4);
    Assert.assertEquals(0, pvkT.getVelocity().subtract(pveT.getVelocity()).getNorm() / dV, 0.2);
  }
Esempio n. 19
0
  @Test
  public void testPropagationTypesElliptical() throws OrekitException, ParseException, IOException {

    NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(5, 5);
    ForceModel gravityField =
        new HolmesFeatherstoneAttractionModel(
            FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider);
    Orbit initialOrbit =
        new KeplerianOrbit(
            8000000.0,
            0.01,
            0.1,
            0.7,
            0,
            1.2,
            PositionAngle.TRUE,
            FramesFactory.getEME2000(),
            AbsoluteDate.J2000_EPOCH,
            provider.getMu());

    double dt = 900;
    double dP = 0.001;
    for (OrbitType orbitType : OrbitType.values()) {
      for (PositionAngle angleType : PositionAngle.values()) {

        // compute state Jacobian using PartialDerivatives
        NumericalPropagator propagator =
            setUpPropagator(initialOrbit, dP, orbitType, angleType, gravityField);
        PartialDerivativesEquations partials =
            new PartialDerivativesEquations("partials", propagator);
        final SpacecraftState initialState =
            partials.setInitialJacobians(new SpacecraftState(initialOrbit), 6, 0);
        propagator.setInitialState(initialState);
        final JacobiansMapper mapper = partials.getMapper();
        PickUpHandler pickUp = new PickUpHandler(mapper, null);
        propagator.setMasterMode(pickUp);
        propagator.propagate(initialState.getDate().shiftedBy(dt));
        double[][] dYdY0 = pickUp.getdYdY0();

        // compute reference state Jacobian using finite differences
        double[][] dYdY0Ref = new double[6][6];
        AbstractIntegratedPropagator propagator2 =
            setUpPropagator(initialOrbit, dP, orbitType, angleType, gravityField);
        double[] steps = NumericalPropagator.tolerances(1000000 * dP, initialOrbit, orbitType)[0];
        for (int i = 0; i < 6; ++i) {
          propagator2.resetInitialState(
              shiftState(initialState, orbitType, angleType, -4 * steps[i], i));
          SpacecraftState sM4h = propagator2.propagate(initialState.getDate().shiftedBy(dt));
          propagator2.resetInitialState(
              shiftState(initialState, orbitType, angleType, -3 * steps[i], i));
          SpacecraftState sM3h = propagator2.propagate(initialState.getDate().shiftedBy(dt));
          propagator2.resetInitialState(
              shiftState(initialState, orbitType, angleType, -2 * steps[i], i));
          SpacecraftState sM2h = propagator2.propagate(initialState.getDate().shiftedBy(dt));
          propagator2.resetInitialState(
              shiftState(initialState, orbitType, angleType, -1 * steps[i], i));
          SpacecraftState sM1h = propagator2.propagate(initialState.getDate().shiftedBy(dt));
          propagator2.resetInitialState(
              shiftState(initialState, orbitType, angleType, 1 * steps[i], i));
          SpacecraftState sP1h = propagator2.propagate(initialState.getDate().shiftedBy(dt));
          propagator2.resetInitialState(
              shiftState(initialState, orbitType, angleType, 2 * steps[i], i));
          SpacecraftState sP2h = propagator2.propagate(initialState.getDate().shiftedBy(dt));
          propagator2.resetInitialState(
              shiftState(initialState, orbitType, angleType, 3 * steps[i], i));
          SpacecraftState sP3h = propagator2.propagate(initialState.getDate().shiftedBy(dt));
          propagator2.resetInitialState(
              shiftState(initialState, orbitType, angleType, 4 * steps[i], i));
          SpacecraftState sP4h = propagator2.propagate(initialState.getDate().shiftedBy(dt));
          fillJacobianColumn(
              dYdY0Ref, i, orbitType, angleType, steps[i], sM4h, sM3h, sM2h, sM1h, sP1h, sP2h, sP3h,
              sP4h);
        }

        for (int i = 0; i < 6; ++i) {
          for (int j = 0; j < 6; ++j) {
            double error = FastMath.abs((dYdY0[i][j] - dYdY0Ref[i][j]) / dYdY0Ref[i][j]);
            Assert.assertEquals(0, error, 6.0e-2);
          }
        }
      }
    }
  }
Esempio n. 20
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);
  }
Esempio n. 21
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);
  }