Search in sources :

Example 86 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method testInitializationCorrectness.

@Test
public void testInitializationCorrectness() throws OrekitException, IOException {
    // Definition of initial conditions
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
    Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
    CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
    // find the default Eckstein-Hechler propagator initialized from the initial orbit
    EcksteinHechlerPropagator defaultEH = new EcksteinHechlerPropagator(initial, provider);
    // the osculating parameters recomputed by the default Eckstein-Hechler propagator are quite different
    // from initial orbit
    CircularOrbit defaultOrbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(defaultEH.propagateOrbit(initial.getDate()));
    Assert.assertEquals(267.4, defaultOrbit.getA() - initial.getA(), 0.1);
    // the position on the other hand match perfectly
    Assert.assertEquals(0.0, Vector3D.distance(defaultOrbit.getPVCoordinates().getPosition(), initial.getPVCoordinates().getPosition()), 1.0e-8);
    // set up a reference numerical propagator starting for the specified start orbit
    // using the same force models (i.e. the first few zonal terms)
    double[][] tol = NumericalPropagator.tolerances(0.1, initial, OrbitType.CIRCULAR);
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
    integrator.setInitialStepSize(60);
    NumericalPropagator num = new NumericalPropagator(integrator);
    num.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(provider)));
    num.setInitialState(new SpacecraftState(initial));
    num.setOrbitType(OrbitType.CIRCULAR);
    // find the best Eckstein-Hechler propagator that match the orbit evolution
    PropagatorConverter converter = new FiniteDifferencePropagatorConverter(new EcksteinHechlerPropagatorBuilder(initial, provider, PositionAngle.TRUE, 1.0), 1.0e-6, 100);
    EcksteinHechlerPropagator fittedEH = (EcksteinHechlerPropagator) converter.convert(num, 3 * initial.getKeplerianPeriod(), 300);
    // the default Eckstein-Hechler propagator did however quite a good job, as it found
    // an orbit close to the best fitting
    CircularOrbit fittedOrbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(fittedEH.propagateOrbit(initial.getDate()));
    Assert.assertEquals(0.623, defaultOrbit.getA() - fittedOrbit.getA(), 0.1);
    // the position on the other hand are slightly different
    // because the fitted orbit minimizes the residuals over a complete time span,
    // not on a single point
    Assert.assertEquals(58.0, Vector3D.distance(defaultOrbit.getPVCoordinates().getPosition(), fittedOrbit.getPVCoordinates().getPosition()), 0.1);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) FiniteDifferencePropagatorConverter(org.orekit.propagation.conversion.FiniteDifferencePropagatorConverter) PropagatorConverter(org.orekit.propagation.conversion.PropagatorConverter) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagatorBuilder(org.orekit.propagation.conversion.EcksteinHechlerPropagatorBuilder) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FiniteDifferencePropagatorConverter(org.orekit.propagation.conversion.FiniteDifferencePropagatorConverter) Transform(org.orekit.frames.Transform) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) Test(org.junit.Test)

Example 87 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method testIssue223.

@Test
public void testIssue223() throws OrekitException, IOException, ClassNotFoundException {
    // Definition of initial conditions
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
    Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
    CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, provider);
    propagator.addAdditionalStateProvider(new SevenProvider());
    propagator.setEphemerisMode();
    propagator.propagate(initial.getDate().shiftedBy(40000));
    BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
    Assert.assertSame(poleAligned, ephemeris.getFrame());
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(ephemeris);
    Assert.assertTrue(bos.size() > 2450);
    Assert.assertTrue(bos.size() < 2550);
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    BoundedPropagator deserialized = (BoundedPropagator) ois.readObject();
    Assert.assertEquals(initial.getA(), deserialized.getInitialState().getA(), 1.0e-10);
    Assert.assertEquals(initial.getEquinoctialEx(), deserialized.getInitialState().getEquinoctialEx(), 1.0e-10);
    SpacecraftState s = deserialized.propagate(initial.getDate().shiftedBy(20000));
    Map<String, double[]> additional = s.getAdditionalStates();
    Assert.assertEquals(1, additional.size());
    Assert.assertEquals(1, additional.get("seven").length);
    Assert.assertEquals(7, additional.get("seven")[0], 1.0e-15);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ByteArrayInputStream(java.io.ByteArrayInputStream) Transform(org.orekit.frames.Transform) BoundedPropagator(org.orekit.propagation.BoundedPropagator) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Example 88 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method stopAtTargetDate.

@Test
public void stopAtTargetDate() 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, 3.986004415e14);
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, provider);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    propagator.addEventDetector(new NodeDetector(orbit, itrf).withHandler(new ContinueOnEvent<NodeDetector>()));
    AbsoluteDate farTarget = orbit.getDate().shiftedBy(10000.0);
    SpacecraftState propagated = propagator.propagate(farTarget);
    Assert.assertEquals(0.0, FastMath.abs(farTarget.durationFrom(propagated.getDate())), 1.0e-3);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) ContinueOnEvent(org.orekit.propagation.events.handlers.ContinueOnEvent) NodeDetector(org.orekit.propagation.events.NodeDetector) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 89 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method wrongAttitude.

@Test(expected = OrekitException.class)
public void wrongAttitude() throws OrekitException {
    KeplerianOrbit orbit = new KeplerianOrbit(1.0e10, 1.0e-4, 1.0e-2, 0, 0, 0, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, 3.986004415e14);
    AttitudeProvider wrongLaw = new AttitudeProvider() {

        private static final long serialVersionUID = 5918362126173997016L;

        public Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame) throws OrekitException {
            throw new OrekitException(new DummyLocalizable("gasp"), new RuntimeException());
        }

        public <T extends RealFieldElement<T>> FieldAttitude<T> getAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame) throws OrekitException {
            throw new OrekitException(new DummyLocalizable("gasp"), new RuntimeException());
        }
    };
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, wrongLaw, provider);
    propagator.propagate(AbsoluteDate.J2000_EPOCH.shiftedBy(10.0));
}
Also used : DummyLocalizable(org.hipparchus.exception.DummyLocalizable) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) RealFieldElement(org.hipparchus.RealFieldElement) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) FieldPVCoordinatesProvider(org.orekit.utils.FieldPVCoordinatesProvider) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) FieldPVCoordinatesProvider(org.orekit.utils.FieldPVCoordinatesProvider) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) Test(org.junit.Test)

Example 90 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class FieldEcksteinHechlerPropagatorTest method doStopAtTargetDate.

private <T extends RealFieldElement<T>> void doStopAtTargetDate(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
    final FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(7.8e6), zero.add(0.032), zero.add(0.4), zero.add(0.1), zero.add(0.2), zero.add(0.3), PositionAngle.TRUE, FramesFactory.getEME2000(), date, 3.986004415e14);
    FieldEcksteinHechlerPropagator<T> propagator = new FieldEcksteinHechlerPropagator<>(orbit, provider);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    propagator.addEventDetector(new FieldNodeDetector<>(orbit, itrf).withHandler(new FieldContinueOnEvent<FieldNodeDetector<T>, T>()));
    FieldAbsoluteDate<T> farTarget = orbit.getDate().shiftedBy(10000.0);
    FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
    Assert.assertEquals(0.0, FastMath.abs(farTarget.durationFrom(propagated.getDate()).getReal()), 1.0e-3);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) FieldNodeDetector(org.orekit.propagation.events.FieldNodeDetector) FieldContinueOnEvent(org.orekit.propagation.events.handlers.FieldContinueOnEvent) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit)

Aggregations

Frame (org.orekit.frames.Frame)257 Test (org.junit.Test)169 AbsoluteDate (org.orekit.time.AbsoluteDate)153 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)117 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)99 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)79 SpacecraftState (org.orekit.propagation.SpacecraftState)79 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)70 OrekitException (org.orekit.errors.OrekitException)60 PVCoordinates (org.orekit.utils.PVCoordinates)58 Orbit (org.orekit.orbits.Orbit)51 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)50 TimeScale (org.orekit.time.TimeScale)46 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)46 GeodeticPoint (org.orekit.bodies.GeodeticPoint)41 TopocentricFrame (org.orekit.frames.TopocentricFrame)38 Transform (org.orekit.frames.Transform)38 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)35 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)33 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)31