Search in sources :

Example 61 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class IsotropicRadiationClassicalConvention method radiationPressureAcceleration.

/**
 * {@inheritDoc}
 */
@Override
public FieldVector3D<DerivativeStructure> radiationPressureAcceleration(final AbsoluteDate date, final Frame frame, final Vector3D position, final Rotation rotation, final double mass, final Vector3D flux, final double[] parameters, final String paramName) throws OrekitException {
    final DerivativeStructure caDS;
    final DerivativeStructure csDS;
    if (ABSORPTION_COEFFICIENT.equals(paramName)) {
        caDS = factory.variable(0, parameters[0]);
        csDS = factory.constant(parameters[1]);
    } else if (REFLECTION_COEFFICIENT.equals(paramName)) {
        caDS = factory.constant(parameters[0]);
        csDS = factory.variable(0, parameters[1]);
    } else {
        throw new OrekitException(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, paramName, ABSORPTION_COEFFICIENT + ", " + REFLECTION_COEFFICIENT);
    }
    final DerivativeStructure kP = caDS.add(csDS).subtract(1).multiply(-4.0 / 9.0).add(1).multiply(crossSection);
    return new FieldVector3D<>(kP.divide(mass), flux);
}
Also used : DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) OrekitException(org.orekit.errors.OrekitException) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D)

Example 62 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class SolarRadiationPressure method acceleration.

/**
 * {@inheritDoc}
 */
@Override
public <T extends RealFieldElement<T>> FieldVector3D<T> acceleration(final FieldSpacecraftState<T> s, final T[] parameters) throws OrekitException {
    final FieldAbsoluteDate<T> date = s.getDate();
    final Frame frame = s.getFrame();
    final FieldVector3D<T> position = s.getPVCoordinates().getPosition();
    final FieldVector3D<T> sunSatVector = position.subtract(sun.getPVCoordinates(date.toAbsoluteDate(), frame).getPosition());
    final T r2 = sunSatVector.getNormSq();
    // compute flux
    final T ratio = getLightingRatio(position, frame, date);
    final T rawP = ratio.divide(r2).multiply(kRef);
    final FieldVector3D<T> flux = new FieldVector3D<>(rawP.divide(r2.sqrt()), sunSatVector);
    return spacecraft.radiationPressureAcceleration(date, frame, position, s.getAttitude().getRotation(), s.getMass(), flux, parameters);
}
Also used : Frame(org.orekit.frames.Frame) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D)

Example 63 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class ConstantThrustManeuverTest method accelerationDerivatives.

@Override
protected FieldVector3D<DerivativeStructure> accelerationDerivatives(final ForceModel forceModel, final AbsoluteDate date, final Frame frame, final FieldVector3D<DerivativeStructure> position, final FieldVector3D<DerivativeStructure> velocity, final FieldRotation<DerivativeStructure> rotation, final DerivativeStructure mass) throws OrekitException {
    try {
        java.lang.reflect.Field firingField = ConstantThrustManeuver.class.getDeclaredField("firing");
        firingField.setAccessible(true);
        boolean firing = firingField.getBoolean(forceModel);
        double thrust = forceModel.getParameterDriver(ConstantThrustManeuver.THRUST).getValue();
        java.lang.reflect.Field directionField = ConstantThrustManeuver.class.getDeclaredField("direction");
        directionField.setAccessible(true);
        Vector3D direction;
        direction = (Vector3D) directionField.get(forceModel);
        if (firing) {
            return new FieldVector3D<>(mass.reciprocal().multiply(thrust), rotation.applyInverseTo(direction));
        } else {
            // constant (and null) acceleration when not firing
            return FieldVector3D.getZero(mass.getField());
        }
    } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
        return null;
    }
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D)

Example 64 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class SolarRadiationPressureTest method testLightingInterplanetary.

@Test
public void testLightingInterplanetary() throws OrekitException, ParseException {
    // Initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 3, 21), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
    Orbit orbit = new KeplerianOrbit(1.0e11, 0.1, 0.2, 0.3, 0.4, 0.5, PositionAngle.TRUE, CelestialBodyFactory.getSolarSystemBarycenter().getInertiallyOrientedFrame(), date, Constants.JPL_SSD_SUN_GM);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    SolarRadiationPressure srp = new SolarRadiationPressure(sun, Constants.SUN_RADIUS, (RadiationSensitive) new IsotropicRadiationClassicalConvention(50.0, 0.5, 0.5));
    Assert.assertFalse(srp.dependsOnPositionOnly());
    Vector3D position = orbit.getPVCoordinates().getPosition();
    Frame frame = orbit.getFrame();
    Assert.assertEquals(1.0, srp.getLightingRatio(position, frame, date), 1.0e-15);
    Assert.assertEquals(1.0, srp.getLightingRatio(new FieldVector3D<>(Decimal64Field.getInstance(), position), frame, new FieldAbsoluteDate<>(Decimal64Field.getInstance(), date)).getReal(), 1.0e-15);
}
Also used : Frame(org.orekit.frames.Frame) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) DateComponents(org.orekit.time.DateComponents) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 65 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class SolarRadiationPressureTest method accelerationDerivatives.

@Override
protected FieldVector3D<DerivativeStructure> accelerationDerivatives(final ForceModel forceModel, final AbsoluteDate date, final Frame frame, final FieldVector3D<DerivativeStructure> position, final FieldVector3D<DerivativeStructure> velocity, final FieldRotation<DerivativeStructure> rotation, final DerivativeStructure mass) throws OrekitException {
    try {
        java.lang.reflect.Field kRefField = SolarRadiationPressure.class.getDeclaredField("kRef");
        kRefField.setAccessible(true);
        double kRef = kRefField.getDouble(forceModel);
        java.lang.reflect.Field sunField = SolarRadiationPressure.class.getDeclaredField("sun");
        sunField.setAccessible(true);
        PVCoordinatesProvider sun = (PVCoordinatesProvider) sunField.get(forceModel);
        java.lang.reflect.Field spacecraftField = SolarRadiationPressure.class.getDeclaredField("spacecraft");
        spacecraftField.setAccessible(true);
        RadiationSensitive spacecraft = (RadiationSensitive) spacecraftField.get(forceModel);
        java.lang.reflect.Method getLightingRatioMethod = SolarRadiationPressure.class.getDeclaredMethod("getLightingRatio", FieldVector3D.class, Frame.class, FieldAbsoluteDate.class);
        getLightingRatioMethod.setAccessible(true);
        final Field<DerivativeStructure> field = position.getX().getField();
        final FieldVector3D<DerivativeStructure> sunSatVector = position.subtract(sun.getPVCoordinates(date, frame).getPosition());
        final DerivativeStructure r2 = sunSatVector.getNormSq();
        // compute flux
        final DerivativeStructure ratio = (DerivativeStructure) getLightingRatioMethod.invoke(forceModel, position, frame, new FieldAbsoluteDate<>(field, date));
        final DerivativeStructure rawP = ratio.multiply(kRef).divide(r2);
        final FieldVector3D<DerivativeStructure> flux = new FieldVector3D<>(rawP.divide(r2.sqrt()), sunSatVector);
        // compute acceleration with all its partial derivatives
        return spacecraft.radiationPressureAcceleration(new FieldAbsoluteDate<>(field, date), frame, position, rotation, mass, flux, forceModel.getParameters(field));
    } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException | NoSuchMethodException | InvocationTargetException e) {
        return null;
    }
}
Also used : DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) InvocationTargetException(java.lang.reflect.InvocationTargetException) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Aggregations

FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)124 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)53 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)49 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)38 Test (org.junit.Test)38 Frame (org.orekit.frames.Frame)36 TimeStampedFieldPVCoordinates (org.orekit.utils.TimeStampedFieldPVCoordinates)31 OrekitException (org.orekit.errors.OrekitException)23 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)20 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)20 Decimal64 (org.hipparchus.util.Decimal64)18 FieldEquinoctialOrbit (org.orekit.orbits.FieldEquinoctialOrbit)15 OrbitType (org.orekit.orbits.OrbitType)15 AbsoluteDate (org.orekit.time.AbsoluteDate)15 DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)14 Transform (org.orekit.frames.Transform)14 FieldDerivativeStructure (org.hipparchus.analysis.differentiation.FieldDerivativeStructure)12 FieldEcksteinHechlerPropagator (org.orekit.propagation.analytical.FieldEcksteinHechlerPropagator)10 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)9 ArrayList (java.util.ArrayList)8