Search in sources :

Example 1 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class DTM2000Test method testWithOriginalTestsCases.

@Test
public void testWithOriginalTestsCases() 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);
    double roTestCase;
    double myRo;
    // Inputs :
    // alt=800.
    // lat=40.
    // day=185.
    // hl=16.
    // xlon=0.
    // fm(1)=150.
    // f(1) =fm(1)
    // fm(2)=0.
    // f(2)=0.
    // akp(1)=0.
    // akp(2)=0.
    // akp(3)=0.
    // akp(4)=0.
    // Outputs :
    roTestCase = 1.8710001353820e-17 * 1000;
    // Computation and results
    myRo = atm.getDensity(185, 800 * 1000, 0, FastMath.toRadians(40), 16 * FastMath.PI / 12, 150, 150, 0, 0);
    Assert.assertEquals(roTestCase, myRo, roTestCase * 1e-14);
    // IDEM., day=275
    roTestCase = 2.8524195214905e-17 * 1000;
    myRo = atm.getDensity(275, 800 * 1000, 0, FastMath.toRadians(40), 16 * FastMath.PI / 12, 150, 150, 0, 0);
    Assert.assertEquals(roTestCase, myRo, roTestCase * 1e-14);
    // IDEM., day=355
    roTestCase = 1.7343324462212e-17 * 1000;
    myRo = atm.getDensity(355, 800 * 1000, 0, FastMath.toRadians(40), 16 * FastMath.PI / 12, 150, 150, 0, 0);
    Assert.assertEquals(roTestCase, myRo, roTestCase * 2e-14);
    // IDEM., day=85
    roTestCase = 2.9983740796297e-17 * 1000;
    myRo = atm.getDensity(85, 800 * 1000, 0, FastMath.toRadians(40), 16 * FastMath.PI / 12, 150, 150, 0, 0);
    Assert.assertEquals(roTestCase, myRo, roTestCase * 1e-14);
    // alt=500.
    // lat=-70.      NB: the subroutine requires latitude in rad
    // day=15.
    // hl=16.        NB: the subroutine requires local time in rad (0hr=0 rad)
    // xlon=0.
    // fm(1)=70.
    // f(1) =fm(1)
    // fm(2)=0.
    // f(2)=0.
    // akp(1)=0.
    // akp(2)=0.
    // akp(3)=0.
    // akp(4)=0.
    // ro=    1.3150282384722D-16
    // tz=    793.65487014559
    // tinf=    793.65549802348
    // note that the values above are the ones present in the original fortran source comments
    // however, running this original source (converted to double precision) does
    // not yield the results in the comments, but instead gives the following results
    // as all the other tests cases do behave correctly, we assume the comments are wrong
    // and prefer to ensure we get the same result as the original CODE
    // as we don't have access to any other tests cases, we can't really decide if this is
    // the best approach. Indeed, we are able to get the same results as original fortran
    roTestCase = 1.5699108952425600E-016 * 1000;
    myRo = atm.getDensity(15, 500 * 1000, 0, FastMath.toRadians(-70), 16 * FastMath.PI / 12, 70, 70, 0, 0);
    Assert.assertEquals(roTestCase, myRo, roTestCase * 1e-14);
    // IDEM., alt=800.
    // ro=    1.9556768571305D-18
    // tz=    793.65549797919
    // tinf=    793.65549802348
    // note that the values above are the ones present in the original fortran source comments
    // however, running this original source (converted to double precision) does
    // not yield the results in the comments, but instead gives the following results
    // as all the other tests cases do behave correctly, we assume the comments are wrong
    // and prefer to ensure we get the same result as the original CODE
    // as we don't have access to any other tests cases, we can't really decide if this is
    // the best approach. Indeed, we are able to get the same results as original fortran
    roTestCase = 2.4123751406975562E-018 * 1000;
    myRo = atm.getDensity(15, 800 * 1000, 0, FastMath.toRadians(-70), 16 * FastMath.PI / 12, 70, 70, 0, 0);
    Assert.assertEquals(roTestCase, myRo, roTestCase * 1e-14);
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) SolarInputs97to05(org.orekit.SolarInputs97to05) Test(org.junit.Test)

Example 2 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class DTM2000Test method testNonEarthRotationAxisAlignedFrame.

@Test
public void testNonEarthRotationAxisAlignedFrame() throws OrekitException {
    // setup
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Rotation rotation = new Rotation(Vector3D.PLUS_I, FastMath.PI / 2, RotationConvention.VECTOR_OPERATOR);
    Frame frame = new Frame(ecef, new Transform(date, rotation), "other");
    Vector3D pEcef = new Vector3D(6378137 + 300e3, 0, 0);
    Vector3D pFrame = ecef.getTransformTo(frame, date).transformPosition(pEcef);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.460, 1.0 / 298.257222101, ecef);
    SolarInputs97to05 in = SolarInputs97to05.getInstance();
    earth.setAngularThreshold(1e-10);
    DTM2000 atm = new DTM2000(in, sun, earth);
    // action
    final double actual = atm.getDensity(date, pFrame, frame);
    // verify
    Assert.assertEquals(atm.getDensity(date, pEcef, ecef), actual, 0.0);
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) SolarInputs97to05(org.orekit.SolarInputs97to05) Transform(org.orekit.frames.Transform) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 3 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class JB2008Test method testLegacy.

@Test
public void testLegacy() throws OrekitException {
    final boolean print = false;
    // Build the model
    final PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    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(null, sun, earth);
    // Reference input data
    final double[] D1950 = { 20035.00454861111, 20035.50362, 20036.00468, 20036.50375, 20037.00000, 20037.50556, 20038.00088, 20038.50644, 20039.00543, 20039.50450, 20040.00000, 20040.50556 };
    final double[] SUNRA = { 3.8826, 3.8914, 3.9001, 3.9089, 3.9176, 3.9265, 3.9352, 3.9441, 3.9529, 3.9618, 3.9706, 3.9795 };
    final double[] SUNDEC = { -0.2847, -0.2873, -0.2898, -0.2923, -0.2948, -0.2973, -0.2998, -0.3022, -0.3046, -0.3070, -0.3094, -0.3117 };
    final double[] SATLON = { 73.46, 218.68, 34.55, 46.25, 216.56, 32.00, 38.83, 213.67, 29.37, 38.12, 211.78, 26.64 };
    final double[] SATLAT = { -85.24, -18.65, 37.71, 74.36, -8.85, -39.64, -51.93, -21.25, 46.43, 65.97, -21.31, -51.87 };
    final double[] SATALT = { 398.91, 376.75, 373.45, 380.61, 374.03, 385.05, 389.83, 376.98, 374.56, 378.97, 377.76, 390.09 };
    final double[] F10 = { 128.80, 128.80, 129.60, 129.60, 124.10, 124.10, 140.90, 140.90, 104.60, 104.60, 94.90, 94.90 };
    final double[] F10B = { 105.60, 105.60, 105.60, 105.60, 105.60, 105.60, 105.60, 105.60, 105.70, 105.70, 105.90, 105.90 };
    final double[] S10 = { 103.50, 103.50, 110.20, 110.20, 109.40, 109.40, 108.60, 108.60, 107.40, 107.40, 110.90, 110.90 };
    final double[] S10B = { 103.80, 103.80, 103.80, 103.80, 103.80, 103.80, 103.70, 103.70, 103.70, 103.70, 103.70, 103.70 };
    final double[] XM10 = { 110.90, 110.90, 115.60, 115.60, 110.00, 110.00, 110.00, 110.00, 106.90, 106.90, 102.20, 102.20 };
    final double[] XM10B = { 106.90, 106.90, 106.90, 106.90, 106.90, 106.90, 107.00, 107.00, 107.10, 107.10, 107.10, 107.10 };
    final double[] Y10 = { 127.90, 127.90, 125.90, 125.90, 127.70, 127.70, 125.60, 125.60, 126.60, 126.60, 126.80, 126.80 };
    final double[] Y10B = { 112.90, 112.90, 112.90, 112.90, 113.00, 113.00, 113.20, 113.20, 113.20, 113.20, 113.30, 113.30 };
    final double[] DSTDTC = { 3., 80., 240., 307., 132., 40., 327., 327., 118., 25., 85., 251. };
    // Loop over cases
    for (int i = 0; i < 12; i++) {
        final double rho = atm.getDensity(MJD(D1950[i]), SUNRA[i], SUNDEC[i], RAP(D1950[i], SATLON[i]), FastMath.toRadians(SATLAT[i]), SATALT[i] * 1000., F10[i], F10B[i], S10[i], S10B[i], XM10[i], XM10B[i], Y10[i], Y10B[i], DSTDTC[i]);
        checkLegacy(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) Test(org.junit.Test)

Example 4 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider 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 5 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class NRLMSISE00Test method testDensity.

@Test
public void testDensity() throws OrekitException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    // Build the input 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);
    // Build the model
    final NRLMSISE00 atm = new NRLMSISE00(ip, sun, earth).withSwitch(9, -1);
    // Build the date
    final AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 172), new TimeComponents(29000.), TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true));
    // 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
    final double rho = atm.getDensity(date, pos, itrf);
    final double lst = 29000. / 3600. - 70. / 15.;
    final double[] ap = { 4., 100., 100., 100., 100., 100., 100. };
    Class<?> outputClass = getOutputClass();
    Constructor<?> cons = outputClass.getDeclaredConstructor(NRLMSISE00.class, Integer.TYPE, Double.TYPE, Double.TYPE, Double.TYPE, Double.TYPE, Double.TYPE, Double.TYPE, double[].class);
    cons.setAccessible(true);
    Method gtd7d = outputClass.getDeclaredMethod("gtd7d", Double.TYPE);
    gtd7d.setAccessible(true);
    Method getDensity = outputClass.getDeclaredMethod("getDensity", Integer.TYPE);
    getDensity.setAccessible(true);
    final Object out = createOutput(atm, 172, 29000., 60., -70, lst, 150., 150., ap);
    gtd7d.invoke(out, 400.0);
    Assert.assertEquals(rho, ((Double) getDensity.invoke(out, 5)).doubleValue(), rho * 1.e-3);
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) Method(java.lang.reflect.Method) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Aggregations

PVCoordinatesProvider (org.orekit.utils.PVCoordinatesProvider)35 Test (org.junit.Test)28 Frame (org.orekit.frames.Frame)22 AbsoluteDate (org.orekit.time.AbsoluteDate)20 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)19 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)16 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)14 OrekitException (org.orekit.errors.OrekitException)13 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)12 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)11 SpacecraftState (org.orekit.propagation.SpacecraftState)11 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)8 Orbit (org.orekit.orbits.Orbit)8 DateComponents (org.orekit.time.DateComponents)8 TimeComponents (org.orekit.time.TimeComponents)8 AttitudeProvider (org.orekit.attitudes.AttitudeProvider)7 DummyLocalizable (org.hipparchus.exception.DummyLocalizable)6 GeodeticPoint (org.orekit.bodies.GeodeticPoint)6 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)6 TopocentricFrame (org.orekit.frames.TopocentricFrame)6