Search in sources :

Example 16 with FieldKeplerianOrbit

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

the class FieldKeplerianPropagatorTest method doTestWrappedAttitudeException.

private <T extends RealFieldElement<T>> void doTestWrappedAttitudeException(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    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(), new FieldAbsoluteDate<>(field), 3.986004415e14);
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit, new AttitudeProvider() {

        private static final long serialVersionUID = 1L;

        public Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame) throws OrekitException {
            throw new OrekitException((Throwable) null, new DummyLocalizable("dummy error"));
        }

        public <Q extends RealFieldElement<Q>> FieldAttitude<Q> getAttitude(FieldPVCoordinatesProvider<Q> pvProv, FieldAbsoluteDate<Q> date, Frame frame) throws OrekitException {
            throw new OrekitException((Throwable) null, new DummyLocalizable("dummy error"));
        }
    });
    propagator.propagate(orbit.getDate().shiftedBy(10.09));
}
Also used : DummyLocalizable(org.hipparchus.exception.DummyLocalizable) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) FieldAttitude(org.orekit.attitudes.FieldAttitude) Attitude(org.orekit.attitudes.Attitude) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) FieldAttitude(org.orekit.attitudes.FieldAttitude) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) FieldPVCoordinatesProvider(org.orekit.utils.FieldPVCoordinatesProvider) OrekitException(org.orekit.errors.OrekitException) AttitudeProvider(org.orekit.attitudes.AttitudeProvider)

Example 17 with FieldKeplerianOrbit

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

the class FieldKeplerianPropagatorTest method doTestAltitude.

private <T extends RealFieldElement<T>> void doTestAltitude(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    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(), new FieldAbsoluteDate<>(field), 3.986004415e14);
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
    BodyShape bodyShape = new OneAxisEllipsoid(6378137.0, 1.0 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    FieldAltitudeDetector<T> detector = new FieldAltitudeDetector<>(orbit.getKeplerianPeriod().multiply(0.05), zero.add(1500000), bodyShape);
    Assert.assertEquals(1500000, detector.getAltitude().getReal(), 1.0e-12);
    propagator.addEventDetector(detector);
    FieldAbsoluteDate<T> farTarget = new FieldAbsoluteDate<>(field).shiftedBy(10000.0);
    FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
    Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() > 5400.0);
    Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() < 5500.0);
    FieldGeodeticPoint<T> gp = bodyShape.transform(propagated.getPVCoordinates().getPosition(), propagated.getFrame(), propagated.getDate());
    Assert.assertEquals(1500000, gp.getAltitude().getReal(), 0.1);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) BodyShape(org.orekit.bodies.BodyShape) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) FieldAltitudeDetector(org.orekit.propagation.events.FieldAltitudeDetector)

Example 18 with FieldKeplerianOrbit

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

the class FieldNodeDetectorTest method doTestIssue158.

private <T extends RealFieldElement<T>> void doTestIssue158(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
    T a = zero.add(3.0e7);
    T e1 = zero.add(0.8);
    T e2 = zero.add(1.0e-4);
    T i = zero.add(1.0);
    T pa = zero.add(1.5 * FastMath.PI);
    T raan = zero.add(5.0);
    T m = zero.add(0);
    Frame frame = FramesFactory.getEME2000();
    double mu = Constants.EIGEN5C_EARTH_MU;
    // highly eccentric, inclined orbit
    final FieldKeplerianOrbit<T> orbit1 = new FieldKeplerianOrbit<>(a, e1, i, pa, raan, m, PositionAngle.MEAN, frame, date, mu);
    FieldEventDetector<T> detector1 = new FieldNodeDetector<>(orbit1, orbit1.getFrame());
    T t1 = orbit1.getKeplerianPeriod();
    Assert.assertEquals(t1.getReal() / 28.82, detector1.getMaxCheckInterval().getReal(), t1.getReal() / 10000);
    // nearly circular, inclined orbit
    final FieldKeplerianOrbit<T> orbit2 = new FieldKeplerianOrbit<>(a, e2, i, pa, raan, m, PositionAngle.MEAN, frame, date, mu);
    FieldEventDetector<T> detector2 = new FieldNodeDetector<>(orbit2, orbit2.getFrame());
    T t2 = orbit2.getKeplerianPeriod();
    Assert.assertEquals(t1.getReal(), t2.getReal(), t1.getReal() / 10000);
    Assert.assertEquals(t2.getReal() / 3, detector2.getMaxCheckInterval().getReal(), t2.getReal() / 10000);
}
Also used : Frame(org.orekit.frames.Frame) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit)

Example 19 with FieldKeplerianOrbit

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

the class FieldNodeDetectorTest method doTestIssue138.

private <T extends RealFieldElement<T>> void doTestIssue138(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    T a = zero.add(800000 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS);
    T e = zero.add(0.0001);
    T i = zero.add(FastMath.toRadians(98));
    T w = zero.add(-90);
    T raan = zero;
    T v = zero;
    Frame inertialFrame = FramesFactory.getEME2000();
    FieldAbsoluteDate<T> initialDate = new FieldAbsoluteDate<>(field, 2014, 01, 01, 0, 0, 0, TimeScalesFactory.getUTC());
    FieldAbsoluteDate<T> finalDate = initialDate.shiftedBy(5000);
    FieldKeplerianOrbit<T> initialOrbit = new FieldKeplerianOrbit<>(a, e, i, w, raan, v, PositionAngle.TRUE, inertialFrame, initialDate, Constants.WGS84_EARTH_MU);
    FieldSpacecraftState<T> initialState = new FieldSpacecraftState<>(initialOrbit, zero.add(1000));
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(initialOrbit);
    // Define 2 instances of NodeDetector:
    FieldEventDetector<T> rawDetector = new FieldNodeDetector<>(zero.add(1e-6), initialState.getOrbit(), initialState.getFrame()).withHandler(new FieldContinueOnEvent<FieldNodeDetector<T>, T>());
    FieldEventsLogger<T> logger1 = new FieldEventsLogger<>();
    FieldEventDetector<T> node1 = logger1.monitorDetector(rawDetector);
    FieldEventsLogger<T> logger2 = new FieldEventsLogger<>();
    FieldEventDetector<T> node2 = logger2.monitorDetector(rawDetector);
    propagator.addEventDetector(node1);
    propagator.addEventDetector(node2);
    // First propagation
    propagator.setEphemerisMode();
    propagator.propagate(finalDate);
    Assert.assertEquals(2, logger1.getLoggedEvents().size());
    Assert.assertEquals(2, logger2.getLoggedEvents().size());
    logger1.clearLoggedEvents();
    logger2.clearLoggedEvents();
    FieldBoundedPropagator<T> postpro = propagator.getGeneratedEphemeris();
    // Post-processing
    postpro.addEventDetector(node1);
    postpro.addEventDetector(node2);
    postpro.propagate(finalDate);
    Assert.assertEquals(2, logger1.getLoggedEvents().size());
    Assert.assertEquals(2, logger2.getLoggedEvents().size());
}
Also used : Frame(org.orekit.frames.Frame) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) FieldKeplerianPropagator(org.orekit.propagation.analytical.FieldKeplerianPropagator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Example 20 with FieldKeplerianOrbit

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

the class BodyCenterPointingTest method doTestSpin.

private <T extends RealFieldElement<T>> void doTestSpin(final Field<T> field) throws OrekitException {
    final double ehMu = 3.9860047e14;
    final double ae = 6.378137e6;
    final double c20 = -1.08263e-3;
    final double c30 = 2.54e-6;
    final double c40 = 1.62e-6;
    final double c50 = 2.3e-7;
    final double c60 = -5.5e-7;
    // Satellite position as circular parameters
    final T zero = field.getZero();
    final T a = zero.add(7178000.0);
    final T e = zero.add(7e-5);
    final T i = zero.add(FastMath.toRadians(50.));
    final T pa = zero.add(FastMath.toRadians(45.));
    final T raan = zero.add(FastMath.toRadians(270.));
    final T m = zero.add(FastMath.toRadians(5.3 - 270));
    // Computation date
    FieldAbsoluteDate<T> date_R = new FieldAbsoluteDate<>(field, new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());
    // Orbit
    FieldKeplerianOrbit<T> circ = new FieldKeplerianOrbit<>(a, e, i, pa, raan, m, PositionAngle.MEAN, FramesFactory.getEME2000(), date_R, ehMu);
    // WGS84 Earth model
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    // Earth center pointing attitude provider
    BodyCenterPointing earthCenterAttitudeLaw = new BodyCenterPointing(circ.getFrame(), earth);
    final FieldAbsoluteDate<T> date = FieldAbsoluteDate.getJ2000Epoch(field).shiftedBy(584.);
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(3220103.), zero.add(69623.), zero.add(6449822.));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(6414.7), zero.add(-2006.), zero.add(-3180.));
    final FieldCircularOrbit<T> initialOrbit = new FieldCircularOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), date, ehMu);
    FieldEcksteinHechlerPropagator<T> propagator = new FieldEcksteinHechlerPropagator<>(initialOrbit, ae, ehMu, c20, c30, c40, c50, c60);
    propagator.setAttitudeProvider(earthCenterAttitudeLaw);
    double h = 0.01;
    FieldSpacecraftState<T> s0 = propagator.propagate(date);
    FieldSpacecraftState<T> sMinus = propagator.propagate(date.shiftedBy(-h));
    FieldSpacecraftState<T> sPlus = propagator.propagate(date.shiftedBy(h));
    // check spin is consistent with attitude evolution
    T errorAngleMinus = FieldRotation.distance(sMinus.shiftedBy(zero.add(h)).getAttitude().getRotation(), s0.getAttitude().getRotation());
    T evolutionAngleMinus = FieldRotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAngleMinus.getReal(), 1.0e-6 * evolutionAngleMinus.getReal());
    T errorAnglePlus = FieldRotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(zero.add(-h)).getAttitude().getRotation());
    T evolutionAnglePlus = FieldRotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAnglePlus.getReal(), 1.0e-6 * evolutionAnglePlus.getReal());
    FieldVector3D<T> spin0 = s0.getAttitude().getSpin();
    FieldVector3D<T> reference = FieldAngularCoordinates.estimateRate(sMinus.getAttitude().getRotation(), sPlus.getAttitude().getRotation(), 2 * h);
    Assert.assertTrue(spin0.getNorm().getReal() > 1.0e-3);
    Assert.assertEquals(0.0, spin0.subtract(reference).getNorm().getReal(), 1.0e-13);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) DateComponents(org.orekit.time.DateComponents) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) FieldEcksteinHechlerPropagator(org.orekit.propagation.analytical.FieldEcksteinHechlerPropagator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldCircularOrbit(org.orekit.orbits.FieldCircularOrbit)

Aggregations

FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)45 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)39 Frame (org.orekit.frames.Frame)25 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)17 OrbitType (org.orekit.orbits.OrbitType)16 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)16 PVCoordinates (org.orekit.utils.PVCoordinates)16 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)14 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)14 Test (org.junit.Test)14 SpacecraftState (org.orekit.propagation.SpacecraftState)14 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)14 DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)13 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)13 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)13 DateComponents (org.orekit.time.DateComponents)13 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)12 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)12 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)12 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)10