use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class StreamingOemWriterTest method testGuessCenter.
/**
* Check guessing the frame center for some frames.
*
* @throws OrekitException on error.
*/
@Test
public void testGuessCenter() throws OrekitException {
// action + verify
// check all CCSDS common center names
List<CenterName> centerNames = new ArrayList<>(Arrays.asList(CenterName.values()));
centerNames.remove(CenterName.EARTH_MOON);
for (CenterName centerName : centerNames) {
CelestialBody body = centerName.getCelestialBody();
String name = centerName.name().replace('_', ' ');
assertThat(StreamingOemWriter.guessCenter(body.getInertiallyOrientedFrame()), CoreMatchers.is(name));
assertThat(StreamingOemWriter.guessCenter(body.getBodyOrientedFrame()), CoreMatchers.is(name));
}
// Earth-Moon Barycenter is special
CelestialBody emb = CenterName.EARTH_MOON.getCelestialBody();
assertThat(StreamingOemWriter.guessCenter(emb.getInertiallyOrientedFrame()), CoreMatchers.is("EARTH-MOON BARYCENTER"));
assertThat(StreamingOemWriter.guessCenter(emb.getBodyOrientedFrame()), CoreMatchers.is("EARTH-MOON BARYCENTER"));
// check some special CCSDS frames
CcsdsModifiedFrame frame = new CcsdsModifiedFrame(FramesFactory.getEME2000(), "EME2000", CelestialBodyFactory.getMars(), "MARS");
assertThat(StreamingOemWriter.guessCenter(frame), CoreMatchers.is("MARS"));
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testWrongParameterLift.
@Test
public void testWrongParameterLift() 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);
try {
s.dragAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), 1.0e-6, Vector3D.PLUS_I, getDragParameters(s), "wrong");
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
Assert.assertEquals(3, oe.getParts().length);
Assert.assertEquals("wrong", (String) oe.getParts()[0]);
Assert.assertEquals(DragSensitive.DRAG_COEFFICIENT, (String) oe.getParts()[1]);
Assert.assertEquals(DragSensitive.LIFT_RATIO, (String) oe.getParts()[2]);
}
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testBackwardIllumination.
@Test
public void testBackwardIllumination() 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);
Vector3D n = s.getNormal(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation());
FieldVector3D<DerivativeStructure> aPlus = s.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), n, getRadiationParameters(s), RadiationSensitive.ABSORPTION_COEFFICIENT);
FieldVector3D<DerivativeStructure> aMinus = s.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), n.negate(), getRadiationParameters(s), RadiationSensitive.ABSORPTION_COEFFICIENT);
Assert.assertEquals(0.0, aPlus.add(aMinus).getNorm().getReal(), Double.MIN_VALUE);
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testNormalOptimalRotationField.
@Test
public void testNormalOptimalRotationField() throws OrekitException {
AbsoluteDate initialDate = propagator.getInitialState().getDate();
CelestialBody sun = CelestialBodyFactory.getSun();
BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, sun, 20.0, Vector3D.PLUS_J, 0.0, 1.0, 0.0);
Field<Decimal64> field = Decimal64Field.getInstance();
for (double dt = 0; dt < 4000; dt += 60) {
AbsoluteDate date = initialDate.shiftedBy(dt);
SpacecraftState state = propagator.propagate(date);
FieldVector3D<Decimal64> normal = s.getNormal(new FieldAbsoluteDate<>(field, state.getDate()), state.getFrame(), new FieldVector3D<>(field, state.getPVCoordinates().getPosition()), new FieldRotation<>(field, state.getAttitude().getRotation()));
Assert.assertEquals(0, FieldVector3D.dotProduct(normal, Vector3D.PLUS_J).getReal(), 1.0e-16);
}
}
use of org.orekit.bodies.CelestialBody in project Orekit by CS-SI.
the class DSSTPropagatorTest method testIssue339WithAccelerations.
@Test
public void testIssue339WithAccelerations() throws OrekitException {
final SpacecraftState osculatingState = getLEOStatePropagatedBy30Minutes();
final CelestialBody sun = CelestialBodyFactory.getSun();
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
final BoxAndSolarArraySpacecraft boxAndWing = new BoxAndSolarArraySpacecraft(5.0, 2.0, 2.0, sun, 50.0, Vector3D.PLUS_J, 2.0, 0.1, 0.2, 0.6);
final Atmosphere atmosphere = new HarrisPriester(CelestialBodyFactory.getSun(), earth, 6);
final AttitudeProvider attitudeProvider = new LofOffset(osculatingState.getFrame(), LOFType.VVLH, RotationOrder.XYZ, 0.0, 0.0, 0.0);
// Surface force models that require an attitude provider
final Collection<DSSTForceModel> forces = new ArrayList<DSSTForceModel>();
forces.add(new DSSTAtmosphericDrag(atmosphere, boxAndWing));
final SpacecraftState meanState = DSSTPropagator.computeMeanState(osculatingState, attitudeProvider, forces);
final SpacecraftState computedOsculatingState = DSSTPropagator.computeOsculatingState(meanState, attitudeProvider, forces);
Assert.assertEquals(0.0, Vector3D.distance(osculatingState.getPVCoordinates().getPosition(), computedOsculatingState.getPVCoordinates().getPosition()), 5.0e-6);
}
Aggregations