use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testTooSlowFixedRate.
@Test
public void testTooSlowFixedRate() 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, initialDate, new Vector3D(0.46565509814462996, 0.0, 0.884966287251619), 0.1 * propagator.getInitialState().getKeplerianMeanMotion(), 0.0, 0.0, 0.0);
double maxDelta = 0;
for (double dt = 0; dt < 4000; dt += 60) {
SpacecraftState state = propagator.propagate(initialDate.shiftedBy(dt));
Vector3D sunInert = sun.getPVCoordinates(initialDate, state.getFrame()).getPosition();
Vector3D momentum = state.getPVCoordinates().getMomentum();
double sunElevation = FastMath.PI / 2 - Vector3D.angle(sunInert, momentum);
Assert.assertEquals(15.1, FastMath.toDegrees(sunElevation), 0.1);
Vector3D n = s.getNormal(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation());
Assert.assertEquals(0.0, n.getY(), 1.0e-10);
// normal misalignment should become very large as solar array rotation is plain wrong
Vector3D sunSat = state.getAttitude().getRotation().applyTo(sunInert);
double misAlignment = Vector3D.angle(sunSat, n);
maxDelta = FastMath.max(maxDelta, FastMath.abs(sunElevation - misAlignment));
}
Assert.assertTrue(FastMath.toDegrees(maxDelta) > 120.0);
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testCorrectFixedRate.
@Test
public void testCorrectFixedRate() 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, initialDate, new Vector3D(0.46565509814462996, 0.0, 0.884966287251619), propagator.getInitialState().getKeplerianMeanMotion(), 0.0, 0.0, 0.0);
for (double dt = 0; dt < 4000; dt += 60) {
SpacecraftState state = propagator.propagate(initialDate.shiftedBy(dt));
Vector3D sunInert = sun.getPVCoordinates(initialDate, state.getFrame()).getPosition();
Vector3D momentum = state.getPVCoordinates().getMomentum();
double sunElevation = FastMath.PI / 2 - Vector3D.angle(sunInert, momentum);
Assert.assertEquals(15.1, FastMath.toDegrees(sunElevation), 0.1);
Vector3D n = s.getNormal(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation());
Assert.assertEquals(0.0, n.getY(), 1.0e-10);
// normal misalignment should be entirely due to sun being out of orbital plane
Vector3D sunSat = state.getAttitude().getRotation().applyTo(sunInert);
double misAlignment = Vector3D.angle(sunSat, n);
Assert.assertEquals(sunElevation, misAlignment, 1.0e-3);
}
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testMissingParameterLift.
@Test
public void testMissingParameterLift() 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, 1.0, 0.0);
try {
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.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
Assert.assertEquals(2, oe.getParts().length);
Assert.assertEquals(DragSensitive.LIFT_RATIO, (String) oe.getParts()[0]);
Assert.assertEquals(DragSensitive.DRAG_COEFFICIENT, (String) oe.getParts()[1]);
}
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testNormalFixedRateDouble.
@Test
public void testNormalFixedRateDouble() throws OrekitException {
AbsoluteDate initialDate = propagator.getInitialState().getDate();
CelestialBody sun = CelestialBodyFactory.getSun();
BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, sun, 20.0, Vector3D.PLUS_J, initialDate, Vector3D.PLUS_K, 1.0e-3, 0.0, 1.0, 0.0);
for (double dt = 0; dt < 4000; dt += 60) {
AbsoluteDate date = initialDate.shiftedBy(dt);
SpacecraftState state = propagator.propagate(date);
Vector3D normal = s.getNormal(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation());
Assert.assertEquals(0, Vector3D.dotProduct(normal, Vector3D.PLUS_J), 1.0e-16);
}
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testNoLiftWithoutReflection.
@Test
public void testNoLiftWithoutReflection() 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, 0.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.assertEquals(0.0, Vector3D.angle(relativeVelocity, drag), 1.0e-15);
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);
}
}
Aggregations