Search in sources :

Example 26 with CelestialBody

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);
}
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 27 with CelestialBody

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);
    }
}
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 28 with CelestialBody

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

Example 29 with CelestialBody

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);
    }
}
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 30 with CelestialBody

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);
    }
}
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)

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