Search in sources :

Example 11 with FieldSpacecraftState

use of org.orekit.propagation.FieldSpacecraftState 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 12 with FieldSpacecraftState

use of org.orekit.propagation.FieldSpacecraftState in project Orekit by CS-SI.

the class FieldEclipseDetectorTest method doTestInsideOcculted.

private <T extends RealFieldElement<T>> void doTestInsideOcculted(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(-6142438.668), zero.add(3492467.560), zero.add(-25767.25680));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(505.8479685), zero.add(942.7809215), zero.add(7435.922231));
    FieldAbsoluteDate<T> iniDate = new FieldAbsoluteDate<>(field, 1969, 7, 28, 4, 0, 0.0, TimeScalesFactory.getTT());
    final FieldOrbit<T> orbit = new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getGCRF(), iniDate, mu);
    FieldSpacecraftState<T> initialState = new FieldSpacecraftState<>(orbit);
    double[] absTolerance = { 0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001 };
    double[] relTolerance = { 1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7 };
    AdaptiveStepsizeFieldIntegrator<T> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 1000, absTolerance, relTolerance);
    integrator.setInitialStepSize(field.getZero().add(60));
    FieldNumericalPropagator<T> propagator = new FieldNumericalPropagator<>(field, integrator);
    propagator.setOrbitType(OrbitType.EQUINOCTIAL);
    propagator.setInitialState(initialState);
    sun = CelestialBodyFactory.getSun();
    earth = CelestialBodyFactory.getEarth();
    sunRadius = 696000000.;
    earthRadius = 6400000.;
    FieldEclipseDetector<T> e = new FieldEclipseDetector<>(field.getZero().add(60.), field.getZero().add(1.e-3), sun, sunRadius, earth, earthRadius);
    Vector3D p = sun.getPVCoordinates(AbsoluteDate.J2000_EPOCH, FramesFactory.getGCRF()).getPosition();
    FieldSpacecraftState<T> s = new FieldSpacecraftState<>(new FieldCartesianOrbit<>(new TimeStampedFieldPVCoordinates<>(FieldAbsoluteDate.getJ2000Epoch(field), new FieldPVCoordinates<>(new FieldVector3D<>(field.getOne(), field.getZero(), field.getZero()).add(p), new FieldVector3D<>(field.getZero(), field.getZero(), field.getOne()))), FramesFactory.getGCRF(), mu));
    Assert.assertEquals(FastMath.PI, e.g(s).getReal(), 1.0e-15);
}
Also used : DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldEquinoctialOrbit(org.orekit.orbits.FieldEquinoctialOrbit) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates)

Example 13 with FieldSpacecraftState

use of org.orekit.propagation.FieldSpacecraftState in project Orekit by CS-SI.

the class LofOffsetPointingTest method checkField.

private <T extends RealFieldElement<T>> void checkField(final Field<T> field, final GroundPointing provider, final Orbit orbit, final AbsoluteDate date, final Frame frame) throws OrekitException {
    final Attitude attitudeD = provider.getAttitude(orbit, date, frame);
    final FieldOrbit<T> orbitF = new FieldSpacecraftState<>(field, new SpacecraftState(orbit)).getOrbit();
    final FieldAbsoluteDate<T> dateF = new FieldAbsoluteDate<>(field, date);
    final FieldAttitude<T> attitudeF = provider.getAttitude(orbitF, dateF, frame);
    Assert.assertEquals(0.0, Rotation.distance(attitudeD.getRotation(), attitudeF.getRotation().toRotation()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getSpin(), attitudeF.getSpin().toVector3D()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), 1.0e-15);
    final TimeStampedPVCoordinates pvD = provider.getTargetPV(orbit, date, frame);
    final TimeStampedFieldPVCoordinates<T> pvF = provider.getTargetPV(orbitF, dateF, frame);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getPosition(), pvF.getPosition().toVector3D()), 9.0e-9);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getVelocity(), pvF.getVelocity().toVector3D()), 5.0e-9);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getAcceleration(), pvF.getAcceleration().toVector3D()), 4.0e-5);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Example 14 with FieldSpacecraftState

use of org.orekit.propagation.FieldSpacecraftState in project Orekit by CS-SI.

the class NadirPointingTest method checkField.

private <T extends RealFieldElement<T>> void checkField(final Field<T> field, final GroundPointing provider, final Orbit orbit, final AbsoluteDate date, final Frame frame) throws OrekitException {
    final Attitude attitudeD = provider.getAttitude(orbit, date, frame);
    final FieldOrbit<T> orbitF = new FieldSpacecraftState<>(field, new SpacecraftState(orbit)).getOrbit();
    final FieldAbsoluteDate<T> dateF = new FieldAbsoluteDate<>(field, date);
    final FieldAttitude<T> attitudeF = provider.getAttitude(orbitF, dateF, frame);
    Assert.assertEquals(0.0, Rotation.distance(attitudeD.getRotation(), attitudeF.getRotation().toRotation()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getSpin(), attitudeF.getSpin().toVector3D()), 2.0e-14);
    Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), 4.0e-12);
    final TimeStampedPVCoordinates pvD = provider.getTargetPV(orbit, date, frame);
    final TimeStampedFieldPVCoordinates<T> pvF = provider.getTargetPV(orbitF, dateF, frame);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getPosition(), pvF.getPosition().toVector3D()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getVelocity(), pvF.getVelocity().toVector3D()), 2.0e-8);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getAcceleration(), pvF.getAcceleration().toVector3D()), 3.0e-5);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Example 15 with FieldSpacecraftState

use of org.orekit.propagation.FieldSpacecraftState in project Orekit by CS-SI.

the class YawSteeringTest method checkField.

private <T extends RealFieldElement<T>> void checkField(final Field<T> field, final GroundPointing provider, final Orbit orbit, final AbsoluteDate date, final Frame frame) throws OrekitException {
    final Attitude attitudeD = provider.getAttitude(orbit, date, frame);
    final FieldOrbit<T> orbitF = new FieldSpacecraftState<>(field, new SpacecraftState(orbit)).getOrbit();
    final FieldAbsoluteDate<T> dateF = new FieldAbsoluteDate<>(field, date);
    final FieldAttitude<T> attitudeF = provider.getAttitude(orbitF, dateF, frame);
    Assert.assertEquals(0.0, Rotation.distance(attitudeD.getRotation(), attitudeF.getRotation().toRotation()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getSpin(), attitudeF.getSpin().toVector3D()), 4.0e-14);
    Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), 3.0e-12);
    final TimeStampedPVCoordinates pvD = provider.getTargetPV(orbit, date, frame);
    final TimeStampedFieldPVCoordinates<T> pvF = provider.getTargetPV(orbitF, dateF, frame);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getPosition(), pvF.getPosition().toVector3D()), 2.0e-9);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getVelocity(), pvF.getVelocity().toVector3D()), 7.0e-8);
    Assert.assertEquals(0.0, Vector3D.distance(pvD.getAcceleration(), pvF.getAcceleration().toVector3D()), 4.0e-5);
}
Also used : FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Aggregations

FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)36 SpacecraftState (org.orekit.propagation.SpacecraftState)24 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)24 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)20 DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)20 OrbitType (org.orekit.orbits.OrbitType)20 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)17 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)17 Frame (org.orekit.frames.Frame)16 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)16 Test (org.junit.Test)15 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)15 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)15 PVCoordinates (org.orekit.utils.PVCoordinates)15 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)14 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)12 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)12 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)11 GaussianRandomGenerator (org.hipparchus.random.GaussianRandomGenerator)8 RandomGenerator (org.hipparchus.random.RandomGenerator)8