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);
}
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);
}
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;
}
}
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);
}
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;
}
}
Aggregations