use of org.orekit.frames.Frame 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);
}
use of org.orekit.frames.Frame 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);
}
use of org.orekit.frames.Frame 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);
}
}
use of org.orekit.frames.Frame 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);
}
}
use of org.orekit.frames.Frame 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));
}
Aggregations