Search in sources :

Example 16 with CircularOrbit

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

the class EcksteinHechlerPropagatorTest method testAcceleration.

@Test
public void testAcceleration() throws OrekitException {
    final KeplerianOrbit orbit = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, provider.getMu());
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, provider);
    AbsoluteDate target = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
    List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
    for (double dt : Arrays.asList(-0.5, 0.0, 0.5)) {
        sample.add(propagator.propagate(target.shiftedBy(dt)).getPVCoordinates());
    }
    TimeStampedPVCoordinates interpolated = TimeStampedPVCoordinates.interpolate(target, CartesianDerivativesFilter.USE_P, sample);
    Vector3D computedP = sample.get(1).getPosition();
    Vector3D computedV = sample.get(1).getVelocity();
    Vector3D referenceP = interpolated.getPosition();
    Vector3D referenceV = interpolated.getVelocity();
    Vector3D computedA = sample.get(1).getAcceleration();
    Vector3D referenceA = interpolated.getAcceleration();
    final CircularOrbit propagated = (CircularOrbit) OrbitType.CIRCULAR.convertType(propagator.propagateOrbit(target));
    final CircularOrbit keplerian = new CircularOrbit(propagated.getA(), propagated.getCircularEx(), propagated.getCircularEy(), propagated.getI(), propagated.getRightAscensionOfAscendingNode(), propagated.getAlphaM(), PositionAngle.MEAN, propagated.getFrame(), propagated.getDate(), propagated.getMu());
    Vector3D keplerianP = keplerian.getPVCoordinates().getPosition();
    Vector3D keplerianV = keplerian.getPVCoordinates().getVelocity();
    Vector3D keplerianA = keplerian.getPVCoordinates().getAcceleration();
    // perturbed orbit position should be similar to Keplerian orbit position
    Assert.assertEquals(0.0, Vector3D.distance(referenceP, computedP), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(referenceP, keplerianP), 4.0e-9);
    // perturbed orbit velocity should be equal to Keplerian orbit because
    // it was in fact reconstructed from Cartesian coordinates
    double computationErrorV = Vector3D.distance(referenceV, computedV);
    double nonKeplerianEffectV = Vector3D.distance(referenceV, keplerianV);
    Assert.assertEquals(nonKeplerianEffectV, computationErrorV, 9.0e-13);
    Assert.assertEquals(2.2e-4, computationErrorV, 3.0e-6);
    // perturbed orbit acceleration should be different from Keplerian orbit because
    // Keplerian orbit doesn't take orbit shape changes into account
    // perturbed orbit acceleration should be consistent with position evolution
    double computationErrorA = Vector3D.distance(referenceA, computedA);
    double nonKeplerianEffectA = Vector3D.distance(referenceA, keplerianA);
    Assert.assertEquals(1.0e-7, computationErrorA, 6.0e-9);
    Assert.assertEquals(6.37e-3, nonKeplerianEffectA, 7.0e-6);
    Assert.assertTrue(computationErrorA < nonKeplerianEffectA / 60000);
}
Also used : CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ArrayList(java.util.ArrayList) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 17 with CircularOrbit

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

the class KeplerianPropagatorTest method testIssue107.

@Test
public void testIssue107() throws OrekitException {
    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 CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new KeplerianPropagator(orbit) {

        private static final long serialVersionUID = 1L;

        AbsoluteDate lastDate = AbsoluteDate.PAST_INFINITY;

        protected SpacecraftState basicPropagate(final AbsoluteDate date) throws OrekitException {
            if (date.compareTo(lastDate) < 0) {
                throw new OrekitException(LocalizedCoreFormats.SIMPLE_MESSAGE, "no backward propagation allowed");
            }
            lastDate = date;
            return super.basicPropagate(date);
        }
    };
    SpacecraftState finalState = propagator.propagate(date.shiftedBy(3600.0));
    Assert.assertEquals(3600.0, finalState.getDate().durationFrom(date), 1.0e-15);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) BoundedPropagator(org.orekit.propagation.BoundedPropagator) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) OrekitException(org.orekit.errors.OrekitException) TimeScale(org.orekit.time.TimeScale) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 18 with CircularOrbit

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

the class OsculatingToMeanElementsConverterTest method testTrivial.

@Test
public void testTrivial() throws Exception {
    final AbsoluteDate date = new AbsoluteDate("2011-12-12T11:57:20.000", TimeScalesFactory.getUTC());
    final Orbit orbit1 = new CircularOrbit(7204535.848109436, -4.484755873986251E-4, 0.0011562979012178316, FastMath.toRadians(98.74341600466741), FastMath.toRadians(43.32990110790338), FastMath.toRadians(180.0), PositionAngle.MEAN, FramesFactory.getGCRF(), date, Constants.WGS84_EARTH_MU);
    final SpacecraftState initialState = new SpacecraftState(orbit1);
    // Set up the numerical propagator
    final double[][] tol = NumericalPropagator.tolerances(1.0, initialState.getOrbit(), initialState.getOrbit().getType());
    final double minStep = 1.;
    final double maxStep = 200.;
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]);
    integrator.setInitialStepSize(100.);
    final NumericalPropagator prop = new NumericalPropagator(integrator);
    prop.setInitialState(initialState);
    final OsculatingToMeanElementsConverter converter = new OsculatingToMeanElementsConverter(initialState, 2, prop, 1.0);
    final SpacecraftState meanOrbit = converter.convert();
    final double eps = 1.e-15;
    Assert.assertEquals(orbit1.getA(), meanOrbit.getA(), eps * orbit1.getA());
    Assert.assertEquals(orbit1.getEquinoctialEx(), meanOrbit.getEquinoctialEx(), eps);
    Assert.assertEquals(orbit1.getEquinoctialEy(), meanOrbit.getEquinoctialEy(), eps);
    Assert.assertEquals(orbit1.getHx(), meanOrbit.getHx(), eps);
    Assert.assertEquals(orbit1.getHy(), meanOrbit.getHy(), eps);
    Assert.assertEquals(MathUtils.normalizeAngle(orbit1.getLM(), FastMath.PI), MathUtils.normalizeAngle(meanOrbit.getLM(), FastMath.PI), eps);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 19 with CircularOrbit

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

the class EventDetectorTest method testIssue108Numerical.

@Test
public void testIssue108Numerical() throws OrekitException {
    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 CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
    final double step = 60.0;
    final int n = 100;
    NumericalPropagator propagator = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(step));
    propagator.resetInitialState(new SpacecraftState(orbit));
    GCallsCounter counter = new GCallsCounter(100000.0, 1.0e-6, 20, new StopOnEvent<GCallsCounter>());
    propagator.addEventDetector(counter);
    propagator.propagate(date.shiftedBy(n * step));
    Assert.assertEquals(n + 1, counter.getCount());
}
Also used : Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) Test(org.junit.Test)

Example 20 with CircularOrbit

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

the class EventDetectorTest method testBasicScheduling.

@Test
public void testBasicScheduling() throws OrekitException {
    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 CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new KeplerianPropagator(orbit);
    double stepSize = 60.0;
    OutOfOrderChecker checker = new OutOfOrderChecker(stepSize);
    propagator.addEventDetector(new DateDetector(date.shiftedBy(5.25 * stepSize)).withHandler(checker));
    propagator.setMasterMode(stepSize, checker);
    propagator.propagate(date.shiftedBy(10 * stepSize));
    Assert.assertTrue(checker.outOfOrderCallDetected());
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

CircularOrbit (org.orekit.orbits.CircularOrbit)63 AbsoluteDate (org.orekit.time.AbsoluteDate)47 Test (org.junit.Test)41 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)34 SpacecraftState (org.orekit.propagation.SpacecraftState)26 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)22 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)21 PVCoordinates (org.orekit.utils.PVCoordinates)21 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)20 Orbit (org.orekit.orbits.Orbit)20 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)15 Frame (org.orekit.frames.Frame)15 DateComponents (org.orekit.time.DateComponents)15 GeodeticPoint (org.orekit.bodies.GeodeticPoint)12 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)12 OrekitException (org.orekit.errors.OrekitException)11 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)11 ArrayList (java.util.ArrayList)9 Before (org.junit.Before)9 BoundedPropagator (org.orekit.propagation.BoundedPropagator)9