Search in sources :

Example 6 with CelestialBody

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"));
}
Also used : ArrayList(java.util.ArrayList) CelestialBody(org.orekit.bodies.CelestialBody) Test(org.junit.Test)

Example 7 with CelestialBody

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]);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) CelestialBody(org.orekit.bodies.CelestialBody) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 8 with CelestialBody

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);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) CelestialBody(org.orekit.bodies.CelestialBody) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) Test(org.junit.Test)

Example 9 with CelestialBody

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);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) CelestialBody(org.orekit.bodies.CelestialBody) Decimal64(org.hipparchus.util.Decimal64) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 10 with CelestialBody

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);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) BoxAndSolarArraySpacecraft(org.orekit.forces.BoxAndSolarArraySpacecraft) HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Atmosphere(org.orekit.forces.drag.atmosphere.Atmosphere) CelestialBody(org.orekit.bodies.CelestialBody) ArrayList(java.util.ArrayList) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) LofOffset(org.orekit.attitudes.LofOffset) DSSTAtmosphericDrag(org.orekit.propagation.semianalytical.dsst.forces.DSSTAtmosphericDrag) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) Test(org.junit.Test)

Aggregations

CelestialBody (org.orekit.bodies.CelestialBody)51 Test (org.junit.Test)43 AbsoluteDate (org.orekit.time.AbsoluteDate)34 SpacecraftState (org.orekit.propagation.SpacecraftState)32 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)27 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)17 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)14 ArrayList (java.util.ArrayList)9 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)7 OrekitException (org.orekit.errors.OrekitException)7 Frame (org.orekit.frames.Frame)7 CartesianOrbit (org.orekit.orbits.CartesianOrbit)7 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)7 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)6 Atmosphere (org.orekit.forces.drag.atmosphere.Atmosphere)6 Orbit (org.orekit.orbits.Orbit)6 DSSTSolarRadiationPressure (org.orekit.propagation.semianalytical.dsst.forces.DSSTSolarRadiationPressure)6 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)5 IsotropicRadiationSingleCoefficient (org.orekit.forces.radiation.IsotropicRadiationSingleCoefficient)5 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)5