Search in sources :

Example 1 with CelestialBody

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

Example 2 with CelestialBody

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);
    }
}
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) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 3 with CelestialBody

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

Example 4 with CelestialBody

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));
}
Also used : Frame(org.orekit.frames.Frame) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) CelestialBody(org.orekit.bodies.CelestialBody) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 5 with CelestialBody

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));
}
Also used : OrekitStepHandler(org.orekit.propagation.sampling.OrekitStepHandler) DTM2000InputParameters(org.orekit.forces.drag.atmosphere.DTM2000InputParameters) Frame(org.orekit.frames.Frame) TimeScale(org.orekit.time.TimeScale) DragForce(org.orekit.forces.drag.DragForce) IERSConventions(org.orekit.utils.IERSConventions) Orbit(org.orekit.orbits.Orbit) StrengthLevel(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation.StrengthLevel) CelestialBody(org.orekit.bodies.CelestialBody) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) SpacecraftState(org.orekit.propagation.SpacecraftState) After(org.junit.After) OrbitType(org.orekit.orbits.OrbitType) PositionAngle(org.orekit.orbits.PositionAngle) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) FastMath(org.hipparchus.util.FastMath) Utils(org.orekit.Utils) Before(org.junit.Before) Constants(org.orekit.utils.Constants) DTM2000(org.orekit.forces.drag.atmosphere.DTM2000) DateComponents(org.orekit.time.DateComponents) FramesFactory(org.orekit.frames.FramesFactory) Atmosphere(org.orekit.forces.drag.atmosphere.Atmosphere) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitMatchers(org.orekit.OrekitMatchers) Test(org.junit.Test) MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) DataProvidersManager(org.orekit.data.DataProvidersManager) Month(org.orekit.time.Month) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) OrekitException(org.orekit.errors.OrekitException) CelestialBodyFactory(org.orekit.bodies.CelestialBodyFactory) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) TimeScalesFactory(org.orekit.time.TimeScalesFactory) IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) Assert(org.junit.Assert) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) CelestialBody(org.orekit.bodies.CelestialBody) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) AbsoluteDate(org.orekit.time.AbsoluteDate) OrekitStepHandler(org.orekit.propagation.sampling.OrekitStepHandler) 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