@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);
  }
  @Test
  public void testNoExtrapolation() throws OrekitException {

    // Propagate of the initial at the initial date
    final SpacecraftState finalState = propagator.propagate(initDate);

    // Initial orbit definition
    final Vector3D initialPosition = initialState.getPVCoordinates().getPosition();
    final Vector3D initialVelocity = initialState.getPVCoordinates().getVelocity();

    // Final orbit definition
    final Vector3D finalPosition = finalState.getPVCoordinates().getPosition();
    final Vector3D finalVelocity = finalState.getPVCoordinates().getVelocity();

    // Check results
    Assert.assertEquals(initialPosition.getX(), finalPosition.getX(), 1.0e-10);
    Assert.assertEquals(initialPosition.getY(), finalPosition.getY(), 1.0e-10);
    Assert.assertEquals(initialPosition.getZ(), finalPosition.getZ(), 1.0e-10);
    Assert.assertEquals(initialVelocity.getX(), finalVelocity.getX(), 1.0e-10);
    Assert.assertEquals(initialVelocity.getY(), finalVelocity.getY(), 1.0e-10);
    Assert.assertEquals(initialVelocity.getZ(), finalVelocity.getZ(), 1.0e-10);
  }
  /** {@inheritDoc} */
  public FieldVector3D<DerivativeStructure> accelerationDerivatives(
      final SpacecraftState s, final String paramName) throws OrekitException {

    complainIfNotSupported(paramName);
    final AbsoluteDate date = s.getDate();
    final Frame frame = s.getFrame();
    final Vector3D position = s.getPVCoordinates().getPosition();
    final Vector3D sunSatVector =
        position.subtract(sun.getPVCoordinates(date, frame).getPosition());
    final double r2 = sunSatVector.getNormSq();

    // compute flux
    final double rawP = kRef * getLightningRatio(position, frame, date) / r2;
    final Vector3D flux = new Vector3D(rawP / FastMath.sqrt(r2), sunSatVector);

    return spacecraft.radiationPressureAcceleration(
        date, frame, position, s.getAttitude().getRotation(), s.getMass(), flux, paramName);
  }
Example #4
0
  /** {@inheritDoc} */
  public void addContribution(final SpacecraftState s, final TimeDerivativesEquations adder)
      throws OrekitException {

    // compute bodies separation vectors and squared norm
    final Vector3D centralToBody = body.getPVCoordinates(s.getDate(), s.getFrame()).getPosition();
    final double r2Central = centralToBody.getNormSq();
    final Vector3D satToBody = centralToBody.subtract(s.getPVCoordinates().getPosition());
    final double r2Sat = satToBody.getNormSq();

    // compute relative acceleration
    final Vector3D gamma =
        new Vector3D(
            gm / (r2Sat * FastMath.sqrt(r2Sat)),
            satToBody,
            -gm / (r2Central * FastMath.sqrt(r2Central)),
            centralToBody);

    // add contribution to the ODE second member
    adder.addXYZAcceleration(gamma.getX(), gamma.getY(), gamma.getZ());
  }
Example #5
0
  /** {@inheritDoc} */
  public FieldVector3D<DerivativeStructure> accelerationDerivatives(
      final SpacecraftState s, final String paramName) throws OrekitException {

    complainIfNotSupported(paramName);

    // compute bodies separation vectors and squared norm
    final Vector3D centralToBody = body.getPVCoordinates(s.getDate(), s.getFrame()).getPosition();
    final double r2Central = centralToBody.getNormSq();
    final Vector3D satToBody = centralToBody.subtract(s.getPVCoordinates().getPosition());
    final double r2Sat = satToBody.getNormSq();

    final DerivativeStructure gmds = new DerivativeStructure(1, 1, 0, gm);

    // compute relative acceleration
    return new FieldVector3D<DerivativeStructure>(
        gmds.divide(r2Sat * FastMath.sqrt(r2Sat)),
        satToBody,
        gmds.divide(-r2Central * FastMath.sqrt(r2Central)),
        centralToBody);
  }
  /** {@inheritDoc} */
  public void addContribution(final SpacecraftState s, final TimeDerivativesEquations adder)
      throws OrekitException {

    final AbsoluteDate date = s.getDate();
    final Frame frame = s.getFrame();
    final Vector3D position = s.getPVCoordinates().getPosition();
    final Vector3D sunSatVector =
        position.subtract(sun.getPVCoordinates(date, frame).getPosition());
    final double r2 = sunSatVector.getNormSq();

    // compute flux
    final double rawP = kRef * getLightningRatio(position, frame, date) / r2;
    final Vector3D flux = new Vector3D(rawP / FastMath.sqrt(r2), sunSatVector);

    final Vector3D acceleration =
        spacecraft.radiationPressureAcceleration(
            date, frame, position, s.getAttitude().getRotation(), s.getMass(), flux);

    // provide the perturbing acceleration to the derivatives adder
    adder.addAcceleration(acceleration, s.getFrame());
  }
 /**
  * The G-function is the difference between the Sat-Sun-Sat-Earth angle and the sum of the
  * Earth's and Sun's apparent radius.
  *
  * @param s the current state information : date, kinematics, attitude
  * @return value of the g function
  * @exception OrekitException if sun or spacecraft position cannot be computed
  */
 public double g(final SpacecraftState s) throws OrekitException {
   final double[] angle =
       getEclipseAngles(s.getPVCoordinates().getPosition(), s.getFrame(), s.getDate());
   return angle[0] - angle[1] - angle[2];
 }
  @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);
  }