Search in sources :

Example 71 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.

the class DragForceTest method testJacobianBoxVs80Implementation.

@Test
public void testJacobianBoxVs80Implementation() throws OrekitException {
    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 03, 01), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
    double i = FastMath.toRadians(98.7);
    double omega = FastMath.toRadians(93.0);
    double OMEGA = FastMath.toRadians(15.0 * 22.5);
    Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, i, omega, OMEGA, 0, PositionAngle.MEAN, FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    final DragForce forceModel = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(), new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true))), new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8, CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J, 1.2, 0.7, 0.2));
    SpacecraftState state = new SpacecraftState(orbit, Propagator.DEFAULT_LAW.getAttitude(orbit, orbit.getDate(), orbit.getFrame()));
    checkStateJacobianVs80Implementation(state, forceModel, new LofOffset(state.getFrame(), LOFType.VVLH), 5e-6, false);
}
Also used : BoxAndSolarArraySpacecraft(org.orekit.forces.BoxAndSolarArraySpacecraft) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) DateComponents(org.orekit.time.DateComponents) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) LofOffset(org.orekit.attitudes.LofOffset) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 72 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.

the class DragForceTest method testParameterDerivativeSphere.

@Test
public void testParameterDerivativeSphere() throws OrekitException {
    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06, -1.32931592294715829e+04);
    final Vector3D vel = new Vector3D(2.14718074509906819e+03, 7.38239351251748485e+03, -1.14097953925384523e+01);
    final SpacecraftState state = new SpacecraftState(new CartesianOrbit(new PVCoordinates(pos, vel), FramesFactory.getGCRF(), new AbsoluteDate(2003, 3, 5, 0, 24, 0.0, TimeScalesFactory.getTAI()), Constants.EIGEN5C_EARTH_MU));
    final DragForce forceModel = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(), new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true))), new IsotropicDrag(2.5, 1.2));
    Assert.assertFalse(forceModel.dependsOnPositionOnly());
    checkParameterDerivative(state, forceModel, DragSensitive.DRAG_COEFFICIENT, 1.0e-4, 2.0e-12);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 73 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.

the class DTM2000Test method testField.

@Test
public void testField() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.460, 1.0 / 298.257222101, itrf);
    SolarInputs97to05 in = SolarInputs97to05.getInstance();
    earth.setAngularThreshold(1e-10);
    DTM2000 atm = new DTM2000(in, sun, earth);
    // Computation and results
    for (double alti = 400; alti < 1000; alti += 50) {
        for (double lon = 0; lon < 6; lon += 0.5) {
            for (double lat = -1.5; lat < 1.5; lat += 0.5) {
                for (double hl = 0; hl < 6; hl += 0.5) {
                    double rhoD = atm.getDensity(185, alti * 1000, lon, lat, hl, 50, 150, 0, 0);
                    Decimal64 rho64 = atm.getDensity(185, new Decimal64(alti * 1000), new Decimal64(lon), new Decimal64(lat), new Decimal64(hl), 50, 150, 0, 0);
                    Assert.assertEquals(rhoD, rho64.getReal(), rhoD * 1e-14);
                }
            }
        }
    }
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Decimal64(org.hipparchus.util.Decimal64) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) SolarInputs97to05(org.orekit.SolarInputs97to05) Test(org.junit.Test)

Example 74 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.

the class JB2008Test method testDensityGradient.

@Test
public void testDensityGradient() throws OrekitException {
    final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
    final JB2008 atm = new JB2008(new InputParams(), CelestialBodyFactory.getSun(), earth);
    final AbsoluteDate date = InputParams.TC[6];
    // Build the position
    final double alt = 400.;
    final double lat = 60.;
    final double lon = -70.;
    final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(lat), FastMath.toRadians(lon), alt * 1000.);
    final Vector3D pos = earth.transform(point);
    // Run
    DerivativeStructure zero = new DSFactory(1, 1).variable(0, 0.0);
    FiniteDifferencesDifferentiator differentiator = new FiniteDifferencesDifferentiator(5, 10.0);
    DerivativeStructure rhoX = differentiator.differentiate((double x) -> {
        try {
            return atm.getDensity(date, new Vector3D(1, pos, x, Vector3D.PLUS_I), itrf);
        } catch (OrekitException oe) {
            return Double.NaN;
        }
    }).value(zero);
    DerivativeStructure rhoY = differentiator.differentiate((double y) -> {
        try {
            return atm.getDensity(date, new Vector3D(1, pos, y, Vector3D.PLUS_J), itrf);
        } catch (OrekitException oe) {
            return Double.NaN;
        }
    }).value(zero);
    DerivativeStructure rhoZ = differentiator.differentiate((double z) -> {
        try {
            return atm.getDensity(date, new Vector3D(1, pos, z, Vector3D.PLUS_K), itrf);
        } catch (OrekitException oe) {
            return Double.NaN;
        }
    }).value(zero);
    DSFactory factory3 = new DSFactory(3, 1);
    Field<DerivativeStructure> field = factory3.getDerivativeField();
    final DerivativeStructure rhoDS = atm.getDensity(new FieldAbsoluteDate<>(field, date), new FieldVector3D<>(factory3.variable(0, pos.getX()), factory3.variable(1, pos.getY()), factory3.variable(2, pos.getZ())), itrf);
    Assert.assertEquals(rhoX.getValue(), rhoDS.getReal(), rhoX.getValue() * 2.0e-14);
    Assert.assertEquals(rhoY.getValue(), rhoDS.getReal(), rhoY.getValue() * 2.0e-14);
    Assert.assertEquals(rhoZ.getValue(), rhoDS.getReal(), rhoZ.getValue() * 2.0e-14);
    Assert.assertEquals(rhoX.getPartialDerivative(1), rhoDS.getPartialDerivative(1, 0, 0), FastMath.abs(6.0e-10 * rhoX.getPartialDerivative(1)));
    Assert.assertEquals(rhoY.getPartialDerivative(1), rhoDS.getPartialDerivative(0, 1, 0), FastMath.abs(6.0e-10 * rhoY.getPartialDerivative(1)));
    Assert.assertEquals(rhoZ.getPartialDerivative(1), rhoDS.getPartialDerivative(0, 0, 1), FastMath.abs(6.0e-10 * rhoY.getPartialDerivative(1)));
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FiniteDifferencesDifferentiator(org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator) Test(org.junit.Test)

Example 75 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.

the class JB2008Test method testException.

@Test
public void testException() throws OrekitException, ParseException {
    final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
    final JB2008 atm = new JB2008(new InputParams(), CelestialBodyFactory.getSun(), earth);
    // alt = 89.999km
    try {
        atm.getDensity(0., 0., 0., 0., 0., 89999.0, 0., 0., 0., 0., 0., 0., 0., 0., 0.);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.ALTITUDE_BELOW_ALLOWED_THRESHOLD, oe.getSpecifier());
        Assert.assertEquals(89999.0, (Double) oe.getParts()[0], 1.0e-15);
        Assert.assertEquals(90000.0, (Double) oe.getParts()[1], 1.0e-15);
    }
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Aggregations

OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)146 Test (org.junit.Test)89 AbsoluteDate (org.orekit.time.AbsoluteDate)83 GeodeticPoint (org.orekit.bodies.GeodeticPoint)65 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)59 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)57 SpacecraftState (org.orekit.propagation.SpacecraftState)48 Frame (org.orekit.frames.Frame)47 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)45 Orbit (org.orekit.orbits.Orbit)42 PVCoordinates (org.orekit.utils.PVCoordinates)42 TopocentricFrame (org.orekit.frames.TopocentricFrame)34 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)31 OrekitException (org.orekit.errors.OrekitException)29 CircularOrbit (org.orekit.orbits.CircularOrbit)29 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)29 DateComponents (org.orekit.time.DateComponents)29 Propagator (org.orekit.propagation.Propagator)28 Before (org.junit.Before)26 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)23