Search in sources :

Example 1 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project SpriteOrbits by ProjectPersephone.

the class SpriteProp method run.

/**
 * run the application.
 * @param out output file
 * @param propagationDuration duration of the propagation
 * @param step fixed step between output lines
 * @param utc UTC time scale
 */
public void run(final PrintStream out, final double propagationDuration, final double step, final TimeScale utc) throws OrekitException {
    final AbsoluteDate start = spritesPropagators.get(0).getInitialState().getDate();
    final AbsoluteDate end = start.shiftedBy(propagationDuration * Constants.JULIAN_DAY);
    /*out.format(Locale.US, "# file generated on %s%n",
                   new AbsoluteDate(new Date(), utc).toString(utc));
        out.format(Locale.US, "# propagating %d sprites from %s to %s%n",
                   spritesPropagators.size(), start.toString(utc), end.toString(utc));
        out.format(Locale.US, "# column 1:    date (UTC)%n");
        out.format(Locale.US, "# column 2:    date offset since start (seconds)%n");
        out.format(Locale.US, "# column 3:    KickSat geodetic latitude (degrees)%n");
        out.format(Locale.US, "# column 4:    KickSat geodetic longitude (degrees)%n");
        out.format(Locale.US, "# column 5:    KickSat geodetic altitude (meters)%n");
        out.format(Locale.US, "# column 3i+3: sprite i geodetic latitude (degrees)%n");
        out.format(Locale.US, "# column 3i+4: sprite i geodetic longitude (degrees)%n");
        out.format(Locale.US, "# column 3i+5: sprite i geodetic altitude (meters)%n");
        */
    // in order to speed up computation, we let the numerical propagator choose its
    // steps, and create ephemerides, then we will use the ephemerides with fixed
    // steps for output
    List<Propagator> ephemerides = new ArrayList<Propagator>(spritesPropagators.size());
    for (final Propagator spritePropagator : spritesPropagators) {
        spritePropagator.setEphemerisMode();
        spritePropagator.propagate(end);
        ephemerides.add(spritePropagator.getGeneratedEphemeris());
    }
    boolean firstTime = true;
    for (AbsoluteDate date = start; date.compareTo(end) < 0; date = date.shiftedBy(step)) {
        if (!firstTime) {
            out.format(Locale.US, ",");
        } else {
            firstTime = false;
        }
        /*out.format(Locale.US, "%s %9.1f", date.toString(utc), date.durationFrom(start));

            final GeodeticPoint kickSatGP = geodeticPosition(kickSatPropagator, date);
            out.format(Locale.US, " %8.3f %8.3f %8.1f",
                       FastMath.toDegrees(kickSatGP.getLatitude()),
                       FastMath.toDegrees(kickSatGP.getLongitude()),
                       kickSatGP.getAltitude());

            for (final Propagator ephemeride : ephemerides) {
                final GeodeticPoint spriteGP = geodeticPosition(ephemeride, date);
                out.format(Locale.US, " %8.3f %8.3f %8.1f",
                           FastMath.toDegrees(spriteGP.getLatitude()),
                           FastMath.toDegrees(spriteGP.getLongitude()),
                           spriteGP.getAltitude());
            }
            */
        out.format(Locale.US, "{\"date\":\"%s\",\"offset\":%.1f,", date.toString(utc), date.durationFrom(start));
        final GeodeticPoint kickSatGP = geodeticPosition(kickSatPropagator, date);
        out.format(Locale.US, "\"kicksat\":{\"lat\":%.3f,\"lng\":%.3f,\"alt\":%.1f},", FastMath.toDegrees(kickSatGP.getLatitude()), FastMath.toDegrees(kickSatGP.getLongitude()), kickSatGP.getAltitude());
        out.format(Locale.US, "\"sprites\":[");
        boolean firstSprite = true;
        for (final Propagator ephemeride : ephemerides) {
            final GeodeticPoint spriteGP = geodeticPosition(ephemeride, date);
            if (!firstSprite) {
                out.format(Locale.US, ",");
            } else {
                firstSprite = false;
            }
            out.format(Locale.US, "{\"lat\":%.3f,\"lng\":%.3f,\"alt\":%.1f}", FastMath.toDegrees(spriteGP.getLatitude()), FastMath.toDegrees(spriteGP.getLongitude()), spriteGP.getAltitude());
        }
        out.format(Locale.US, "]}");
        out.println();
    }
}
Also used : Propagator(org.orekit.propagation.Propagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) ArrayList(java.util.ArrayList) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AbsoluteDate(org.orekit.time.AbsoluteDate)

Example 2 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project SpriteOrbits by ProjectPersephone.

the class SpritePropOrig method run.

/**
 * run the application.
 * @param out output file
 * @param propagationDuration duration of the propagation
 * @param step fixed step between output lines
 * @param utc UTC time scale
 */
public void run(final PrintStream out, final double propagationDuration, final double step, final TimeScale utc) throws OrekitException {
    final AbsoluteDate start = spritesPropagators.get(0).getInitialState().getDate();
    final AbsoluteDate end = start.shiftedBy(propagationDuration * Constants.JULIAN_DAY);
    out.format(Locale.US, "# file generated on %s%n", new AbsoluteDate(new Date(), utc).toString(utc));
    out.format(Locale.US, "# propagating %d sprites from %s to %s%n", spritesPropagators.size(), start.toString(utc), end.toString(utc));
    out.format(Locale.US, "# column 1:    date (UTC)%n");
    out.format(Locale.US, "# column 2:    date offset since start (seconds)%n");
    out.format(Locale.US, "# column 3:    KickSat geodetic latitude (degrees)%n");
    out.format(Locale.US, "# column 4:    KickSat geodetic longitude (degrees)%n");
    out.format(Locale.US, "# column 5:    KickSat geodetic altitude (meters)%n");
    out.format(Locale.US, "# column 3i+3: sprite i geodetic latitude (degrees)%n");
    out.format(Locale.US, "# column 3i+4: sprite i geodetic longitude (degrees)%n");
    out.format(Locale.US, "# column 3i+5: sprite i geodetic altitude (meters)%n");
    // in order to speed up computation, we let the numerical propagator choose its
    // steps, and create ephemerides, then we will use the ephemerides with fixed
    // steps for output
    List<Propagator> ephemerides = new ArrayList<Propagator>(spritesPropagators.size());
    for (final Propagator spritePropagator : spritesPropagators) {
        spritePropagator.setEphemerisMode();
        spritePropagator.propagate(end);
        ephemerides.add(spritePropagator.getGeneratedEphemeris());
    }
    for (AbsoluteDate date = start; date.compareTo(end) < 0; date = date.shiftedBy(step)) {
        out.format(Locale.US, "%s %9.1f", date.toString(utc), date.durationFrom(start));
        final GeodeticPoint kickSatGP = geodeticPosition(kickSatPropagator, date);
        out.format(Locale.US, " %8.3f %8.3f %8.1f", FastMath.toDegrees(kickSatGP.getLatitude()), FastMath.toDegrees(kickSatGP.getLongitude()), kickSatGP.getAltitude());
        for (final Propagator ephemeride : ephemerides) {
            final GeodeticPoint spriteGP = geodeticPosition(ephemeride, date);
            out.format(Locale.US, " %8.3f %8.3f %8.1f", FastMath.toDegrees(spriteGP.getLatitude()), FastMath.toDegrees(spriteGP.getLongitude()), spriteGP.getAltitude());
        }
        out.println();
    }
}
Also used : Propagator(org.orekit.propagation.Propagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) ArrayList(java.util.ArrayList) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AbsoluteDate(org.orekit.time.AbsoluteDate) Date(java.util.Date) AbsoluteDate(org.orekit.time.AbsoluteDate)

Example 3 with GeodeticPoint

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

the class JB2008Test method testAltitude.

@Test
public void testAltitude() throws OrekitException {
    final boolean print = false;
    // Build the iput params provider
    final InputParams ip = new InputParams();
    // Get Sun
    final PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    // Get Earth body shape
    final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
    earth.setAngularThreshold(1e-10);
    // Build the model
    final JB2008 atm = new JB2008(ip, sun, earth);
    // Reference locations as {lat, lon, alt}
    final double[][] loc = { { -85.24, 73.46, 91.0e+3 }, { -18.65, 218.68, 110.0e+3 }, { -68.05, 145.28, 122.0e+3 }, { 37.71, 34.55, 150.0e+3 }, { 74.36, 46.25, 220.0e+3 }, { -8.85, 216.56, 270.0e+3 }, { -39.64, 32.00, 400.0e+3 }, { -51.93, 38.83, 550.0e+3 }, { -21.25, 213.67, 700.0e+3 }, { 46.43, 29.37, 900.0e+3 }, { 65.97, 38.12, 1200.0e+3 }, { -21.31, 211.78, 1700.0e+3 }, { -51.87, 26.64, 2300.0e+3 } };
    // Loop over cases
    for (int i = 0; i < 13; i++) {
        // Build the point
        final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(loc[i][0]), FastMath.toRadians(loc[i][1]), loc[i][2]);
        // Run
        final double rho = atm.getDensity(InputParams.TC[i], earth.transform(point), atm.getFrame());
        // Check
        checkAltitude(i, rho, print);
    }
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) GeodeticPoint(org.orekit.bodies.GeodeticPoint) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 4 with GeodeticPoint

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

the class HarrisPriesterTest method testVelocityDerivative.

@Test
public void testVelocityDerivative() throws OrekitException {
    final Frame eme2000 = FramesFactory.getEME2000();
    final HarrisPriester hp = new HarrisPriester(sun, earth);
    final Vector3D pos = earth.getBodyFrame().getTransformTo(eme2000, date).transformPosition(earth.transform(new GeodeticPoint(-1.7, 4.2, 987654.321)));
    double dP = 100.0;
    double dVxdX = gradientComponent(hp, pos, Vector3D.PLUS_I, dP, eme2000, v -> v.getX());
    double dVxdY = gradientComponent(hp, pos, Vector3D.PLUS_J, dP, eme2000, v -> v.getX());
    double dVxdZ = gradientComponent(hp, pos, Vector3D.PLUS_K, dP, eme2000, v -> v.getX());
    double dVydX = gradientComponent(hp, pos, Vector3D.PLUS_I, dP, eme2000, v -> v.getY());
    double dVydY = gradientComponent(hp, pos, Vector3D.PLUS_J, dP, eme2000, v -> v.getY());
    double dVydZ = gradientComponent(hp, pos, Vector3D.PLUS_K, dP, eme2000, v -> v.getY());
    double dVzdX = gradientComponent(hp, pos, Vector3D.PLUS_I, dP, eme2000, v -> v.getZ());
    double dVzdY = gradientComponent(hp, pos, Vector3D.PLUS_J, dP, eme2000, v -> v.getZ());
    double dVzdZ = gradientComponent(hp, pos, Vector3D.PLUS_K, dP, eme2000, v -> v.getZ());
    DSFactory factory = new DSFactory(3, 1);
    FieldVector3D<DerivativeStructure> dsPos = new FieldVector3D<>(factory.variable(0, pos.getX()), factory.variable(1, pos.getY()), factory.variable(2, pos.getZ()));
    FieldVector3D<DerivativeStructure> dsVel = hp.getVelocity(new FieldAbsoluteDate<>(factory.getDerivativeField(), date), dsPos, eme2000);
    Assert.assertEquals(dVxdX, dsVel.getX().getPartialDerivative(1, 0, 0), 1.0e-16);
    Assert.assertEquals(dVxdY, dsVel.getX().getPartialDerivative(0, 1, 0), 1.0e-16);
    Assert.assertEquals(dVxdZ, dsVel.getX().getPartialDerivative(0, 0, 1), 1.0e-16);
    Assert.assertEquals(dVydX, dsVel.getY().getPartialDerivative(1, 0, 0), 1.0e-16);
    Assert.assertEquals(dVydY, dsVel.getY().getPartialDerivative(0, 1, 0), 1.0e-16);
    Assert.assertEquals(dVydZ, dsVel.getY().getPartialDerivative(0, 0, 1), 1.0e-16);
    Assert.assertEquals(dVzdX, dsVel.getZ().getPartialDerivative(1, 0, 0), 1.0e-16);
    Assert.assertEquals(dVzdY, dsVel.getZ().getPartialDerivative(0, 1, 0), 1.0e-16);
    Assert.assertEquals(dVzdZ, dsVel.getZ().getPartialDerivative(0, 0, 1), 1.0e-16);
}
Also used : Frame(org.orekit.frames.Frame) HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Test(org.junit.Test)

Example 5 with GeodeticPoint

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

the class HarrisPriesterTest method testUserTab.

@Test
public void testUserTab() throws OrekitException {
    final double[][] userTab = { { 100000., 4.974e+02, 4.974e+02 }, { 110000., 7.800e+01, 7.800e+01 }, { 120000., 2.490e+01, 2.400e+01 }, { 130000., 8.377e+00, 8.710e+00 }, { 140000., 3.899e+00, 4.059e+00 }, { 150000., 2.122e+00, 2.215e+00 }, { 160000., 1.263e+00, 1.344e+00 }, { 170000., 8.008e-01, 8.758e-01 }, { 180000., 5.283e-01, 6.010e-01 }, { 190000., 3.618e-01, 4.297e-01 }, { 200000., 2.557e-01, 3.162e-01 }, { 210000., 1.839e-01, 2.396e-01 }, { 220000., 1.341e-01, 1.853e-01 }, { 230000., 9.949e-02, 1.455e-01 }, { 240000., 7.488e-02, 1.157e-01 }, { 250000., 5.709e-02, 9.308e-02 }, { 260000., 4.403e-02, 7.555e-02 }, { 270000., 3.430e-02, 6.182e-02 }, { 280000., 2.697e-02, 5.095e-02 }, { 290000., 2.139e-02, 4.226e-02 }, { 300000., 1.708e-02, 3.526e-02 }, { 320000., 1.099e-02, 2.511e-02 }, { 340000., 7.214e-03, 1.819e-02 }, { 360000., 4.824e-03, 1.337e-02 }, { 380000., 3.274e-03, 9.955e-03 }, { 400000., 2.249e-03, 7.492e-03 }, { 420000., 1.558e-03, 5.684e-03 }, { 440000., 1.091e-03, 4.355e-03 }, { 460000., 7.701e-04, 3.362e-03 }, { 480000., 5.474e-04, 2.612e-03 }, { 500000., 3.916e-04, 2.042e-03 }, { 520000., 2.819e-04, 1.605e-03 }, { 540000., 2.042e-04, 1.267e-03 }, { 560000., 1.488e-04, 1.005e-03 }, { 580000., 1.092e-04, 7.997e-04 }, { 600000., 8.070e-05, 6.390e-04 }, { 620000., 6.012e-05, 5.123e-04 }, { 640000., 4.519e-05, 4.121e-04 }, { 660000., 3.430e-05, 3.325e-04 }, { 680000., 2.632e-05, 2.691e-04 }, { 700000., 2.043e-05, 2.185e-04 }, { 720000., 1.607e-05, 1.779e-04 }, { 740000., 1.281e-05, 1.452e-04 }, { 760000., 1.036e-05, 1.190e-04 }, { 780000., 8.496e-06, 9.776e-05 }, { 800000., 7.069e-06, 8.059e-05 }, { 850000., 4.800e-06, 5.500e-05 }, { 900000., 3.300e-06, 3.700e-05 }, { 950000., 2.450e-06, 2.400e-05 }, { 1000000., 1.900e-06, 1.700e-05 }, { 1100000., 1.180e-06, 8.700e-06 }, { 1200000., 7.500e-07, 4.800e-06 }, { 1300000., 5.300e-07, 3.200e-06 }, { 1400000., 4.100e-07, 2.000e-06 }, { 1500000., 2.900e-07, 1.350e-06 }, { 1600000., 2.000e-07, 9.500e-07 }, { 1700000., 1.600e-07, 7.700e-07 }, { 1800000., 1.200e-07, 6.300e-07 }, { 1900000., 9.600e-08, 5.200e-07 }, { 2000000., 7.300e-08, 4.400e-07 } };
    // Position at 1500 km height
    final GeodeticPoint point = new GeodeticPoint(0, 0, 1500000.);
    final Vector3D pos = earth.transform(point);
    final HarrisPriester hp = new HarrisPriester(sun, earth, userTab);
    // COMPUTE DENSITY KG/M3 RHO
    final double rho = hp.getDensity(date, pos, earthFrame);
    Assert.assertEquals(2.9049E-7, rho, 1.0e-11);
    final HarrisPriester hp6 = new HarrisPriester(sun, earth, userTab, 6);
    final double rho6 = hp6.getDensity(date, pos, earthFrame);
    final HarrisPriester hp2 = new HarrisPriester(sun, earth, userTab, 2);
    final double rho2 = hp2.getDensity(date, pos, earthFrame);
    final double c2Psi2 = 0.02163787;
    Assert.assertEquals(c2Psi2, (rho6 - rho2) / (rho - rho2) - 1., 1.0e-8);
}
Also used : HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Aggregations

GeodeticPoint (org.orekit.bodies.GeodeticPoint)133 Test (org.junit.Test)78 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)67 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)61 AbsoluteDate (org.orekit.time.AbsoluteDate)45 TopocentricFrame (org.orekit.frames.TopocentricFrame)35 Frame (org.orekit.frames.Frame)34 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)27 SpacecraftState (org.orekit.propagation.SpacecraftState)26 Propagator (org.orekit.propagation.Propagator)24 OrekitException (org.orekit.errors.OrekitException)23 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)23 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)22 PVCoordinates (org.orekit.utils.PVCoordinates)20 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)19 BodyShape (org.orekit.bodies.BodyShape)17 Orbit (org.orekit.orbits.Orbit)15 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)13 ArrayList (java.util.ArrayList)12 FieldGeodeticPoint (org.orekit.bodies.FieldGeodeticPoint)12