use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testPresentParameterLift.
@Test
public void testPresentParameterLift() throws OrekitException {
SpacecraftState state = propagator.getInitialState();
CelestialBody sun = CelestialBodyFactory.getSun();
BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, sun, 20.0, Vector3D.PLUS_J, 2.0, 0.4, 1.0, 0.0);
FieldVector3D<DerivativeStructure> a = s.dragAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), 1.0e-6, Vector3D.PLUS_I, getDragParameters(s), DragSensitive.LIFT_RATIO);
Assert.assertEquals(5.58e-10, a.getNorm().getReal(), 1.0e-12);
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testOnlyLiftWithoutReflection.
@Test
public void testOnlyLiftWithoutReflection() throws OrekitException {
AbsoluteDate initialDate = propagator.getInitialState().getDate();
CelestialBody sun = CelestialBodyFactory.getSun();
BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(1.5, 3.5, 2.5, sun, 20.0, Vector3D.PLUS_J, 1.0, 1.0, 1.0, 0.0);
Vector3D earthRot = new Vector3D(0.0, 0.0, 7.292115e-4);
for (double dt = 0; dt < 4000; dt += 60) {
AbsoluteDate date = initialDate.shiftedBy(dt);
SpacecraftState state = propagator.propagate(date);
// simple Earth fixed atmosphere
Vector3D p = state.getPVCoordinates().getPosition();
Vector3D v = state.getPVCoordinates().getVelocity();
Vector3D vAtm = Vector3D.crossProduct(earthRot, p);
Vector3D relativeVelocity = vAtm.subtract(v);
Vector3D drag = s.dragAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), 0.001, relativeVelocity, getDragParameters(s));
Assert.assertTrue(Vector3D.angle(relativeVelocity, drag) > 0.167);
Assert.assertTrue(Vector3D.angle(relativeVelocity, drag) < 0.736);
Vector3D sunDirection = sun.getPVCoordinates(date, state.getFrame()).getPosition().normalize();
Vector3D flux = new Vector3D(-4.56e-6, sunDirection);
Vector3D radiation = s.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), flux, getRadiationParameters(s));
Assert.assertEquals(0.0, Vector3D.angle(flux, radiation), 1.0e-9);
}
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testWrongParameterRadiation.
@Test
public void testWrongParameterRadiation() throws OrekitException {
SpacecraftState state = propagator.getInitialState();
CelestialBody sun = CelestialBodyFactory.getSun();
BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, sun, 20.0, Vector3D.PLUS_J, 0.0, 1.0, 0.0);
try {
s.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), Vector3D.PLUS_I, getRadiationParameters(s), "wrong");
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
Assert.assertEquals("wrong", (String) oe.getParts()[0]);
}
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testLiftVsNoLift.
@Test
public void testLiftVsNoLift() throws OrekitException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
CelestialBody sun = CelestialBodyFactory.getSun();
// older implementation did not consider lift, so it really worked
// only for symmetrical shapes. For testing purposes, we will use a
// basic cubic shape without solar arrays and a relative atmosphere
// velocity either *exactly* facing a side or *exactly* along a main diagonal
BoxAndSolarArraySpacecraft.Facet[] facets = new BoxAndSolarArraySpacecraft.Facet[] { new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_I, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_I, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_J, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_J, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_K, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_K, 3.0) };
BoxAndSolarArraySpacecraft cube = new BoxAndSolarArraySpacecraft(facets, sun, 0.0, Vector3D.PLUS_J, 1.0, 1.0, 1.0, 0.0);
AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
Frame frame = FramesFactory.getEME2000();
Vector3D position = new Vector3D(1234567.8, 9876543.21, 121212.3434);
double mass = 1000.0;
double density = 0.001;
Rotation rotation = Rotation.IDENTITY;
// head-on, there acceleration with lift should be twice acceleration without lift
Vector3D headOnVelocity = new Vector3D(2000, 0.0, 0.0);
Vector3D newHeadOnDrag = cube.dragAcceleration(date, frame, position, rotation, mass, density, headOnVelocity, getDragParameters(cube));
Vector3D oldHeadOnDrag = oldDragAcceleration(cube, date, frame, position, rotation, mass, density, headOnVelocity);
Assert.assertThat(newHeadOnDrag, OrekitMatchers.vectorCloseTo(oldHeadOnDrag.scalarMultiply(2), 1));
// on an angle, the no lift implementation applies drag to the velocity direction
// instead of to the facet normal direction. In the symmetrical case, this implies
// it applied a single cos(θ) coefficient (projected surface reduction) instead
// of using cos²(θ) (projected surface reduction *and* normal component projection)
// and since molecule is reflected backward with the same velocity, this implies a
// factor 2 in linear momentum differences
Vector3D diagonalVelocity = new Vector3D(2000, 2000, 2000);
Vector3D newDiagDrag = cube.dragAcceleration(date, frame, position, rotation, mass, density, diagonalVelocity, getDragParameters(cube));
Vector3D oldDiagDrag = oldDragAcceleration(cube, date, frame, position, rotation, mass, density, diagonalVelocity);
double oldMissingCoeff = 2.0 / FastMath.sqrt(3.0);
Vector3D fixedOldDrag = new Vector3D(oldMissingCoeff, oldDiagDrag);
Assert.assertThat(newDiagDrag, OrekitMatchers.vectorCloseTo(fixedOldDrag, 1));
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class MarshallSolarActivityFutureEstimationTest method testWithPropagator.
/**
* Check integration error is small when integrating the same equations over the same
* interval.
*
* @throws OrekitException on error.
*/
@Test
public void testWithPropagator() throws OrekitException {
CelestialBody sun = CelestialBodyFactory.getSun();
final Frame eci = FramesFactory.getGCRF();
final Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
AbsoluteDate date = new AbsoluteDate(2004, 1, 1, utc);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, ecef);
Orbit orbit = new KeplerianOrbit(6378137 + 400e3, 1e-3, FastMath.toRadians(50), 0, 0, 0, PositionAngle.TRUE, eci, date, Constants.EIGEN5C_EARTH_MU);
final SpacecraftState ic = new SpacecraftState(orbit);
final AbsoluteDate end = date.shiftedBy(5 * Constants.JULIAN_DAY);
final AbsoluteDate resetDate = date.shiftedBy(0.8 * Constants.JULIAN_DAY + 0.1);
final SpacecraftState[] lastState = new SpacecraftState[1];
final OrekitStepHandler stepSaver = (interpolator, isLast) -> {
final AbsoluteDate start = interpolator.getPreviousState().getDate();
if (start.compareTo(resetDate) < 0) {
lastState[0] = interpolator.getPreviousState();
}
};
// propagate with state rest to take slightly different path
NumericalPropagator propagator = getNumericalPropagator(sun, earth, ic);
propagator.setMasterMode(stepSaver);
propagator.propagate(resetDate);
propagator.resetInitialState(lastState[0]);
propagator.setSlaveMode();
final SpacecraftState actual = propagator.propagate(end);
// propagate straight through
propagator = getNumericalPropagator(sun, earth, ic);
propagator.resetInitialState(ic);
propagator.setSlaveMode();
final SpacecraftState expected = propagator.propagate(end);
assertThat(actual.getPVCoordinates(), pvCloseTo(expected.getPVCoordinates(), 1.0));
}
Aggregations