Search in sources :

Example 61 with KeplerianOrbit

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

the class AggregateBoundedPropagatorTest method createPropagator.

/**
 * Create a propagator with the given dates.
 *
 * @param start date.
 * @param end   date.
 * @param v     true anomaly.
 * @return a bound propagator with the given dates.
 * @throws OrekitException on error.
 */
private BoundedPropagator createPropagator(AbsoluteDate start, AbsoluteDate end, double v) throws OrekitException {
    double gm = Constants.EGM96_EARTH_MU;
    KeplerianPropagator propagator = new KeplerianPropagator(new KeplerianOrbit(6778137, 0, 0, 0, 0, v, PositionAngle.TRUE, frame, start, gm));
    propagator.setEphemerisMode();
    propagator.propagate(start, end);
    return propagator.getGeneratedEphemeris();
}
Also used : KeplerianOrbit(org.orekit.orbits.KeplerianOrbit)

Example 62 with KeplerianOrbit

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

the class EphemerisEventsTest method buildEphem.

private Ephemeris buildEphem(OrbitType type) throws IllegalArgumentException, OrekitException {
    double mass = 2500;
    double a = 7187990.1979844316;
    double e = 0.5e-4;
    double i = 1.7105407051081795;
    double omega = 1.9674147913622104;
    double OMEGA = FastMath.toRadians(261);
    double lv = 0;
    double mu = 3.9860047e14;
    double ae = 6.378137e6;
    double c20 = -1.08263e-3;
    double c30 = 2.54e-6;
    double c40 = 1.62e-6;
    double c50 = 2.3e-7;
    double c60 = -5.5e-7;
    double deltaT = finalDate.durationFrom(initDate);
    Orbit transPar = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
    int nbIntervals = 720;
    Propagator propagator = new EcksteinHechlerPropagator(transPar, mass, ae, mu, c20, c30, c40, c50, c60);
    List<SpacecraftState> tab = new ArrayList<SpacecraftState>(nbIntervals + 1);
    for (int j = 0; j <= nbIntervals; j++) {
        SpacecraftState state = propagator.propagate(initDate.shiftedBy((j * deltaT) / nbIntervals));
        tab.add(new SpacecraftState(type.convertType(state.getOrbit()), state.getAttitude(), state.getMass()));
    }
    return new Ephemeris(tab, 2);
}
Also used : EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Propagator(org.orekit.propagation.Propagator) ArrayList(java.util.ArrayList) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Ephemeris(org.orekit.propagation.analytical.Ephemeris)

Example 63 with KeplerianOrbit

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

the class PropagatorsParallelizerTest method setUp.

@Before
public void setUp() {
    try {
        Utils.setDataRoot("regular-data:potential/icgem-format");
        unnormalizedGravityField = GravityFieldFactory.getUnnormalizedProvider(6, 0);
        normalizedGravityField = GravityFieldFactory.getNormalizedProvider(6, 0);
        mass = 2500;
        double a = 7187990.1979844316;
        double e = 0.5e-4;
        double i = 1.7105407051081795;
        double omega = 1.9674147913622104;
        double OMEGA = FastMath.toRadians(261);
        double lv = 0;
        AbsoluteDate date = new AbsoluteDate(new DateComponents(2004, 01, 01), TimeComponents.H00, TimeScalesFactory.getUTC());
        orbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), date, normalizedGravityField.getMu());
        OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
        attitudeLaw = new BodyCenterPointing(orbit.getFrame(), earth);
    } catch (OrekitException oe) {
        Assert.fail(oe.getLocalizedMessage());
    }
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) BodyCenterPointing(org.orekit.attitudes.BodyCenterPointing) DateComponents(org.orekit.time.DateComponents) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Example 64 with KeplerianOrbit

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

the class EcksteinHechlerPropagatorTest method sameDateKeplerian.

@Test
public void sameDateKeplerian() throws OrekitException {
    // Definition of initial conditions with Keplerian parameters
    // -----------------------------------------------------------
    AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH.shiftedBy(584.);
    Orbit initialOrbit = new KeplerianOrbit(7209668.0, 0.5e-4, 1.7, 2.1, 2.9, 6.2, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, provider.getMu());
    // Extrapolator definition
    // -----------------------
    EcksteinHechlerPropagator extrapolator = new EcksteinHechlerPropagator(initialOrbit, Propagator.DEFAULT_MASS, provider);
    // Extrapolation at the initial date
    // ---------------------------------
    SpacecraftState finalOrbit = extrapolator.propagate(initDate);
    // positions match perfectly
    Assert.assertEquals(0.0, Vector3D.distance(initialOrbit.getPVCoordinates().getPosition(), finalOrbit.getPVCoordinates().getPosition()), 3.0e-8);
    // velocity and circular parameters do *not* match, this is EXPECTED!
    // the reason is that we ensure position/velocity are consistent with the
    // evolution of the orbit, and this includes the non-Keplerian effects,
    // whereas the initial orbit is Keplerian only. The implementation of the
    // model is such that rather than having a perfect match at initial point
    // (either in velocity or in circular parameters), we have a propagated orbit
    // that remains close to a numerical reference throughout the orbit.
    // This is shown in the testInitializationCorrectness() where a numerical
    // fit is used to check initialization
    Assert.assertEquals(0.137, Vector3D.distance(initialOrbit.getPVCoordinates().getVelocity(), finalOrbit.getPVCoordinates().getVelocity()), 1.0e-3);
    Assert.assertEquals(126.8, finalOrbit.getA() - initialOrbit.getA(), 0.1);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 65 with KeplerianOrbit

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

the class EcksteinHechlerPropagatorTest method propagatedKeplerian.

@Test
public void propagatedKeplerian() throws OrekitException {
    // Definition of initial conditions with Keplerian parameters
    // -----------------------------------------------------------
    AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH.shiftedBy(584.);
    Orbit initialOrbit = new KeplerianOrbit(7209668.0, 0.5e-4, 1.7, 2.1, 2.9, 6.2, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, provider.getMu());
    // Extrapolator definition
    // -----------------------
    EcksteinHechlerPropagator extrapolator = new EcksteinHechlerPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC, RotationOrder.XYZ, 0, 0, 0), 2000.0, provider);
    // Extrapolation at a final date different from initial date
    // ---------------------------------------------------------
    // extrapolation duration in seconds
    double delta_t = 100000.0;
    AbsoluteDate extrapDate = initDate.shiftedBy(delta_t);
    SpacecraftState finalOrbit = extrapolator.propagate(extrapDate);
    Assert.assertEquals(0.0, finalOrbit.getDate().durationFrom(extrapDate), 1.0e-9);
    // computation of M final orbit
    double LM = finalOrbit.getLE() - finalOrbit.getEquinoctialEx() * FastMath.sin(finalOrbit.getLE()) + finalOrbit.getEquinoctialEy() * FastMath.cos(finalOrbit.getLE());
    Assert.assertEquals(LM, finalOrbit.getLM(), Utils.epsilonAngle);
    // test of tan((LE - Lv)/2) :
    Assert.assertEquals(FastMath.tan((finalOrbit.getLE() - finalOrbit.getLv()) / 2.), tangLEmLv(finalOrbit.getLv(), finalOrbit.getEquinoctialEx(), finalOrbit.getEquinoctialEy()), Utils.epsilonAngle);
    // test of evolution of M vs E: LM = LE - ex*sin(LE) + ey*cos(LE)
    // with ex and ey the same for initial and final orbit
    double deltaM = finalOrbit.getLM() - initialOrbit.getLM();
    double deltaE = finalOrbit.getLE() - initialOrbit.getLE();
    double delta = finalOrbit.getEquinoctialEx() * FastMath.sin(finalOrbit.getLE()) - initialOrbit.getEquinoctialEx() * FastMath.sin(initialOrbit.getLE()) - finalOrbit.getEquinoctialEy() * FastMath.cos(finalOrbit.getLE()) + initialOrbit.getEquinoctialEy() * FastMath.cos(initialOrbit.getLE());
    Assert.assertEquals(deltaM, deltaE - delta, Utils.epsilonAngle * FastMath.abs(deltaE - delta));
    // for final orbit
    double ex = finalOrbit.getEquinoctialEx();
    double ey = finalOrbit.getEquinoctialEy();
    double hx = finalOrbit.getHx();
    double hy = finalOrbit.getHy();
    double LE = finalOrbit.getLE();
    double ex2 = ex * ex;
    double ey2 = ey * ey;
    double hx2 = hx * hx;
    double hy2 = hy * hy;
    double h2p1 = 1. + hx2 + hy2;
    double beta = 1. / (1. + FastMath.sqrt(1. - ex2 - ey2));
    double x3 = -ex + (1. - beta * ey2) * FastMath.cos(LE) + beta * ex * ey * FastMath.sin(LE);
    double y3 = -ey + (1. - beta * ex2) * FastMath.sin(LE) + beta * ex * ey * FastMath.cos(LE);
    Vector3D U = new Vector3D((1. + hx2 - hy2) / h2p1, (2. * hx * hy) / h2p1, (-2. * hy) / h2p1);
    Vector3D V = new Vector3D((2. * hx * hy) / h2p1, (1. - hx2 + hy2) / h2p1, (2. * hx) / h2p1);
    Vector3D r = new Vector3D(finalOrbit.getA(), (new Vector3D(x3, U, y3, V)));
    Assert.assertEquals(finalOrbit.getPVCoordinates().getPosition().getNorm(), r.getNorm(), Utils.epsilonTest * r.getNorm());
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) LofOffset(org.orekit.attitudes.LofOffset) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) 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