Search in sources :

Example 36 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class OrekitStepHandlerTest method testIsInterpolated.

/**
 * Check {@link OrekitStepInterpolator#isPreviousStateInterpolated()} and {@link
 * OrekitStepInterpolator#isCurrentStateInterpolated()}.
 *
 * @throws OrekitException on error.
 */
@Test
public void testIsInterpolated() throws OrekitException {
    // setup
    NumericalPropagator propagator = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(60));
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Frame eci = FramesFactory.getGCRF();
    SpacecraftState ic = new SpacecraftState(new KeplerianOrbit(6378137 + 500e3, 1e-3, 0, 0, 0, 0, PositionAngle.TRUE, eci, date, Constants.EIGEN5C_EARTH_MU));
    propagator.setInitialState(ic);
    propagator.setOrbitType(OrbitType.CARTESIAN);
    // detector triggers half way through second step
    DateDetector detector = new DateDetector(date.shiftedBy(90)).withHandler(new ContinueOnEvent<>());
    propagator.addEventDetector(detector);
    // action and verify
    Queue<Boolean> expected = new ArrayDeque<>(Arrays.asList(false, false, false, true, true, false));
    propagator.setMasterMode(new OrekitStepHandler() {

        @Override
        public void handleStep(OrekitStepInterpolator interpolator, boolean isLast) {
            assertEquals(expected.poll(), interpolator.isPreviousStateInterpolated());
            assertEquals(expected.poll(), interpolator.isCurrentStateInterpolated());
        }
    });
    final AbsoluteDate end = date.shiftedBy(120);
    assertEquals(end, propagator.propagate(end).getDate());
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) Frame(org.orekit.frames.Frame) FactoryManagedFrame(org.orekit.frames.FactoryManagedFrame) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) AbsoluteDate(org.orekit.time.AbsoluteDate) ArrayDeque(java.util.ArrayDeque) SpacecraftState(org.orekit.propagation.SpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test)

Example 37 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class FieldNodeDetector method estimateNodesTimeSeparation.

/**
 * Find time separation between nodes.
 * <p>
 * The estimation of time separation is based on Keplerian motion, it is only
 * used as a rough guess for a safe setting of default max check interval for
 * event detection.
 * </p>
 * @param orbit initial orbit
 * @return minimum time separation between nodes
 */
private static double estimateNodesTimeSeparation(final Orbit orbit) {
    final KeplerianOrbit keplerian = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(orbit);
    // mean anomaly of ascending node
    final double ascendingM = new KeplerianOrbit(keplerian.getA(), keplerian.getE(), keplerian.getI(), keplerian.getPerigeeArgument(), keplerian.getRightAscensionOfAscendingNode(), -keplerian.getPerigeeArgument(), PositionAngle.TRUE, keplerian.getFrame(), keplerian.getDate(), keplerian.getMu()).getMeanAnomaly();
    // mean anomaly of descending node
    final double descendingM = new KeplerianOrbit(keplerian.getA(), keplerian.getE(), keplerian.getI(), keplerian.getPerigeeArgument(), keplerian.getRightAscensionOfAscendingNode(), FastMath.PI - keplerian.getPerigeeArgument(), PositionAngle.TRUE, keplerian.getFrame(), keplerian.getDate(), keplerian.getMu()).getMeanAnomaly();
    // differences between mean anomalies
    final double delta1 = MathUtils.normalizeAngle(ascendingM, descendingM + FastMath.PI) - descendingM;
    final double delta2 = 2 * FastMath.PI - delta1;
    // minimum time separation between the two nodes
    return FastMath.min(delta1, delta2) / keplerian.getKeplerianMeanMotion();
}
Also used : KeplerianOrbit(org.orekit.orbits.KeplerianOrbit)

Example 38 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class TLEPropagatorBuilder method buildPropagator.

/**
 * {@inheritDoc}
 */
public Propagator buildPropagator(final double[] normalizedParameters) throws OrekitException {
    // create the orbit
    setParameters(normalizedParameters);
    final Orbit orbit = createInitialOrbit();
    // we really need a Keplerian orbit type
    final KeplerianOrbit kep = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(orbit);
    final TLE tle = new TLE(satelliteNumber, classification, launchYear, launchNumber, launchPiece, TLE.DEFAULT, elementNumber, orbit.getDate(), kep.getKeplerianMeanMotion(), 0.0, 0.0, kep.getE(), MathUtils.normalizeAngle(orbit.getI(), FastMath.PI), MathUtils.normalizeAngle(kep.getPerigeeArgument(), FastMath.PI), MathUtils.normalizeAngle(kep.getRightAscensionOfAscendingNode(), FastMath.PI), MathUtils.normalizeAngle(kep.getMeanAnomaly(), FastMath.PI), revolutionNumberAtEpoch, bStar);
    return TLEPropagator.selectExtrapolator(tle);
}
Also used : KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TLE(org.orekit.propagation.analytical.tle.TLE)

Example 39 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class RelativityTest method testSmallEffectOnOrbit.

/**
 * check against example in Tapley, Schutz, and Born, p 65-66. They predict a
 * progression of perigee of 11 arcsec/year. To get the same results we must set the
 * propagation tolerances to 1e-5.
 *
 * @throws OrekitException on error
 */
@Test
public void testSmallEffectOnOrbit() throws OrekitException {
    // setup
    final double gm = Constants.EIGEN5C_EARTH_MU;
    Orbit orbit = new KeplerianOrbit(7500e3, 0.025, FastMath.toRadians(41.2), 0, 0, 0, PositionAngle.TRUE, frame, date, gm);
    double[][] tol = NumericalPropagator.tolerances(0.00001, orbit, OrbitType.CARTESIAN);
    AbstractIntegrator integrator = new DormandPrince853Integrator(1, 3600, tol[0], tol[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setOrbitType(OrbitType.CARTESIAN);
    propagator.addForceModel(new Relativity(gm));
    propagator.setInitialState(new SpacecraftState(orbit));
    // action: propagate a period
    AbsoluteDate end = orbit.getDate().shiftedBy(30 * Constants.JULIAN_DAY);
    PVCoordinates actual = propagator.getPVCoordinates(end, frame);
    // verify
    KeplerianOrbit endOrbit = new KeplerianOrbit(actual, frame, end, gm);
    KeplerianOrbit startOrbit = new KeplerianOrbit(orbit);
    double dp = endOrbit.getPerigeeArgument() - startOrbit.getPerigeeArgument();
    double dtYears = end.durationFrom(orbit.getDate()) / Constants.JULIAN_YEAR;
    double dpDeg = FastMath.toDegrees(dp);
    // change in argument of perigee in arcseconds per year
    double arcsecPerYear = dpDeg * 3600 / dtYears;
    Assert.assertEquals(11, arcsecPerYear, 0.5);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 40 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class SolidTidesTest method testTideEffect1996.

@Test
public void testTideEffect1996() throws OrekitException {
    Frame eme2000 = FramesFactory.getEME2000();
    TimeScale utc = TimeScalesFactory.getUTC();
    AbsoluteDate date = new AbsoluteDate(2003, 07, 01, 13, 59, 27.816, utc);
    Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, FastMath.toRadians(98.7), FastMath.toRadians(93.0), FastMath.toRadians(15.0 * 22.5), 0, PositionAngle.MEAN, eme2000, date, Constants.EIGEN5C_EARTH_MU);
    doTestTideEffect(orbit, IERSConventions.IERS_1996, 44.09481, 0.00000);
}
Also used : Frame(org.orekit.frames.Frame) Orbit(org.orekit.orbits.Orbit) FieldCartesianOrbit(org.orekit.orbits.FieldCartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeScale(org.orekit.time.TimeScale) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Aggregations

KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)211 Test (org.junit.Test)175 AbsoluteDate (org.orekit.time.AbsoluteDate)154 SpacecraftState (org.orekit.propagation.SpacecraftState)146 Orbit (org.orekit.orbits.Orbit)101 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)96 Frame (org.orekit.frames.Frame)71 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)65 CartesianOrbit (org.orekit.orbits.CartesianOrbit)57 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)54 DateComponents (org.orekit.time.DateComponents)50 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)46 PVCoordinates (org.orekit.utils.PVCoordinates)45 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)43 TimeComponents (org.orekit.time.TimeComponents)43 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)42 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)41 Propagator (org.orekit.propagation.Propagator)39 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)36 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)35