Search in sources :

Example 6 with IERSConventions

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

the class TidalDisplacementTest method doTestDehant.

private void doTestDehant(final IERSConventions conventions, final boolean removePermanentDeformation, final boolean replaceModels, final double expectedDx, final double expectedDy, final double expectedDz, final double tolerance) throws OrekitException {
    Frame itrf = FramesFactory.getITRF(conventions, false);
    TimeScale ut1 = TimeScalesFactory.getUT1(conventions, false);
    final double re;
    final double sunEarthSystemMassRatio;
    final double earthMoonMassRatio;
    if (replaceModels) {
        // constants consistent with DEHANTTIDEINEL.F reference program
        // available at <ftp://tai.bipm.org/iers/conv2010/chapter7/dehanttideinel/>
        // and Copyright (C) 2008 IERS Conventions Center
        re = 6378136.6;
        final double massRatioSun = 332946.0482;
        final double massRatioMoon = 0.0123000371;
        sunEarthSystemMassRatio = massRatioSun * (1.0 / (1.0 + massRatioMoon));
        earthMoonMassRatio = 1.0 / massRatioMoon;
    } else {
        // constants consistent with IERS and JPL
        re = Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS;
        sunEarthSystemMassRatio = Constants.JPL_SSD_SUN_EARTH_PLUS_MOON_MASS_RATIO;
        earthMoonMassRatio = Constants.JPL_SSD_EARTH_MOON_MASS_RATIO;
    }
    // fake providers generating only the positions from the reference program test
    PVCoordinatesProvider fakeSun = (date, frame) -> new TimeStampedPVCoordinates(date, new Vector3D(137859926952.015, 54228127881.435, 23509422341.6960), Vector3D.ZERO, Vector3D.ZERO);
    PVCoordinatesProvider fakeMoon = (date, frame) -> new TimeStampedPVCoordinates(date, new Vector3D(-179996231.920342, -312468450.131567, -169288918.592160), Vector3D.ZERO, Vector3D.ZERO);
    TidalDisplacement td = new TidalDisplacement(re, sunEarthSystemMassRatio, earthMoonMassRatio, fakeSun, fakeMoon, conventions, removePermanentDeformation);
    FundamentalNutationArguments arguments = null;
    if (replaceModels) {
        try {
            // we override the official IERS conventions 2010 arguments with fake arguments matching DEHANTTIDEINEL.F code
            String regularArguments = "/assets/org/orekit/IERS-conventions/2010/nutation-arguments.txt";
            arguments = new FundamentalNutationArguments(conventions, ut1, IERSConventions.class.getResourceAsStream(regularArguments), regularArguments) {

                private static final long serialVersionUID = 20170913L;

                @Override
                public BodiesElements evaluateAll(final AbsoluteDate date) {
                    BodiesElements base = super.evaluateAll(date);
                    double fhr = date.getComponents(ut1).getTime().getSecondsInUTCDay() / 3600.0;
                    double t = base.getTC();
                    // Doodson fundamental arguments as per DEHANTTIDEINEL.F code
                    double s = 218.31664563 + (481267.88194 + (-0.0014663889 + (0.00000185139) * t) * t) * t;
                    double tau = fhr * 15 + 280.4606184 + (36000.7700536 + (0.00038793 + (-0.0000000258) * t) * t) * t - s;
                    double pr = (1.396971278 + (0.000308889 + (0.000000021 + (0.000000007) * t) * t) * t) * t;
                    double h = 280.46645 + (36000.7697489 + (0.00030322222 + (0.000000020 + (-0.00000000654) * t) * t) * t) * t;
                    double p = 83.35324312 + (4069.01363525 + (-0.01032172222 + (-0.0000124991 + (0.00000005263) * t) * t) * t) * t;
                    double zns = 234.95544499 + (1934.13626197 + (-0.00207561111 + (-0.00000213944 + (0.00000001650) * t) * t) * t) * t;
                    double ps = 282.93734098 + (1.71945766667 + (0.00045688889 + (-0.00000001778 + (-0.00000000334) * t) * t) * t) * t;
                    s += pr;
                    // rebuild Delaunay arguments from Doodson arguments, ignoring derivatives
                    return new BodiesElements(date, base.getTC(), FastMath.toRadians(s + tau), 0.0, FastMath.toRadians(s - p), 0.0, FastMath.toRadians(h - ps), 0.0, FastMath.toRadians(s + zns), 0.0, FastMath.toRadians(s - h), 0.0, FastMath.toRadians(-zns), 0.0, base.getLMe(), 0.0, base.getLVe(), 0.0, base.getLE(), 0.0, base.getLMa(), 0.0, base.getLJu(), 0.0, base.getLSa(), 0.0, base.getLUr(), 0.0, base.getLNe(), 0.0, base.getPa(), 0.0);
                }
            };
            // we override the official IERS conventions 2010 tides displacements with tides displacements matching DEHANTTIDEINEL.F code
            String table73a = "/tides/tab7.3a-Dehant.txt";
            Field diurnalCorrectionField = td.getClass().getDeclaredField("frequencyCorrectionDiurnal");
            diurnalCorrectionField.setAccessible(true);
            Method diurnalCorrectionGetter = IERSConventions.class.getDeclaredMethod("getTidalDisplacementFrequencyCorrectionDiurnal", String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE);
            diurnalCorrectionGetter.setAccessible(true);
            diurnalCorrectionField.set(td, diurnalCorrectionGetter.invoke(null, table73a, 18, 15, 16, 17, 18));
        } catch (SecurityException | NoSuchMethodException | NoSuchFieldException | InvocationTargetException | IllegalArgumentException | IllegalAccessException e) {
            Assert.fail(e.getLocalizedMessage());
        }
    } else {
        arguments = conventions.getNutationArguments(ut1);
    }
    Vector3D fundamentalStationWettzell = new Vector3D(4075578.385, 931852.890, 4801570.154);
    AbsoluteDate date = new AbsoluteDate(2009, 4, 13, 0, 0, 0.0, ut1);
    Vector3D displacement = td.displacement(arguments.evaluateAll(date), itrf, fundamentalStationWettzell);
    Assert.assertEquals(expectedDx, displacement.getX(), tolerance);
    Assert.assertEquals(expectedDy, displacement.getY(), tolerance);
    Assert.assertEquals(expectedDz, displacement.getZ(), tolerance);
}
Also used : Constants(org.orekit.utils.Constants) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FramesFactory(org.orekit.frames.FramesFactory) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) Frame(org.orekit.frames.Frame) TimeScale(org.orekit.time.TimeScale) Test(org.junit.Test) IERSConventions(org.orekit.utils.IERSConventions) Field(java.lang.reflect.Field) InvocationTargetException(java.lang.reflect.InvocationTargetException) TidalDisplacement(org.orekit.models.earth.displacement.TidalDisplacement) OrekitException(org.orekit.errors.OrekitException) TimeScalesFactory(org.orekit.time.TimeScalesFactory) BodiesElements(org.orekit.data.BodiesElements) FastMath(org.hipparchus.util.FastMath) Assert(org.junit.Assert) Method(java.lang.reflect.Method) FundamentalNutationArguments(org.orekit.data.FundamentalNutationArguments) Utils(org.orekit.Utils) Before(org.junit.Before) AbsoluteDate(org.orekit.time.AbsoluteDate) FundamentalNutationArguments(org.orekit.data.FundamentalNutationArguments) Frame(org.orekit.frames.Frame) Method(java.lang.reflect.Method) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) InvocationTargetException(java.lang.reflect.InvocationTargetException) Field(java.lang.reflect.Field) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) BodiesElements(org.orekit.data.BodiesElements) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) TidalDisplacement(org.orekit.models.earth.displacement.TidalDisplacement)

Example 7 with IERSConventions

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

the class FundamentalNutationArgumentsTest method testDotField.

@Test
public void testDotField() throws OrekitException {
    final IERSConventions conventions = IERSConventions.IERS_2010;
    final TimeScale ut1 = TimeScalesFactory.getUT1(conventions, false);
    final FundamentalNutationArguments fna = conventions.getNutationArguments(ut1);
    final FieldAbsoluteDate<Decimal64> t0 = new FieldAbsoluteDate<>(Decimal64Field.getInstance(), 2002, 4, 7, 12, 34, 22.5, TimeScalesFactory.getUTC());
    final UnivariateDifferentiableFunction gamma = differentiate(fna, t0, b -> b.getGamma());
    final UnivariateDifferentiableFunction l = differentiate(fna, t0, b -> b.getL());
    final UnivariateDifferentiableFunction lPrime = differentiate(fna, t0, b -> b.getLPrime());
    final UnivariateDifferentiableFunction f = differentiate(fna, t0, b -> b.getF());
    final UnivariateDifferentiableFunction d = differentiate(fna, t0, b -> b.getD());
    final UnivariateDifferentiableFunction lMe = differentiate(fna, t0, b -> b.getLMe());
    final UnivariateDifferentiableFunction lVe = differentiate(fna, t0, b -> b.getLVe());
    final UnivariateDifferentiableFunction lE = differentiate(fna, t0, b -> b.getLE());
    final UnivariateDifferentiableFunction lMa = differentiate(fna, t0, b -> b.getLMa());
    final UnivariateDifferentiableFunction lJu = differentiate(fna, t0, b -> b.getLJu());
    final UnivariateDifferentiableFunction lSa = differentiate(fna, t0, b -> b.getLSa());
    final UnivariateDifferentiableFunction lUr = differentiate(fna, t0, b -> b.getLUr());
    final UnivariateDifferentiableFunction lNe = differentiate(fna, t0, b -> b.getLNe());
    final UnivariateDifferentiableFunction pa = differentiate(fna, t0, b -> b.getPa());
    final DSFactory factory = new DSFactory(1, 1);
    double maxErrorGamma = 0;
    double maxErrorL = 0;
    double maxErrorLPrime = 0;
    double maxErrorF = 0;
    double maxErrorD = 0;
    double maxErrorLMe = 0;
    double maxErrorLVe = 0;
    double maxErrorLE = 0;
    double maxErrorLMa = 0;
    double maxErrorLJu = 0;
    double maxErrorLSa = 0;
    double maxErrorLUr = 0;
    double maxErrorLNe = 0;
    double maxErrorPa = 0;
    for (double dt = 0; dt < Constants.JULIAN_DAY; dt += 60.0) {
        FieldBodiesElements<Decimal64> be = fna.evaluateAll(t0.shiftedBy(dt));
        DerivativeStructure dtDS = factory.variable(0, dt);
        maxErrorGamma = FastMath.max(maxErrorGamma, FastMath.abs(gamma.value(dtDS).getPartialDerivative(1) - be.getGammaDot().getReal()));
        maxErrorL = FastMath.max(maxErrorL, FastMath.abs(l.value(dtDS).getPartialDerivative(1) - be.getLDot().getReal()));
        maxErrorLPrime = FastMath.max(maxErrorLPrime, FastMath.abs(lPrime.value(dtDS).getPartialDerivative(1) - be.getLPrimeDot().getReal()));
        maxErrorF = FastMath.max(maxErrorF, FastMath.abs(f.value(dtDS).getPartialDerivative(1) - be.getFDot().getReal()));
        maxErrorD = FastMath.max(maxErrorD, FastMath.abs(d.value(dtDS).getPartialDerivative(1) - be.getDDot().getReal()));
        maxErrorLMe = FastMath.max(maxErrorLMe, FastMath.abs(lMe.value(dtDS).getPartialDerivative(1) - be.getLMeDot().getReal()));
        maxErrorLVe = FastMath.max(maxErrorLVe, FastMath.abs(lVe.value(dtDS).getPartialDerivative(1) - be.getLVeDot().getReal()));
        maxErrorLE = FastMath.max(maxErrorLE, FastMath.abs(lE.value(dtDS).getPartialDerivative(1) - be.getLEDot().getReal()));
        maxErrorLMa = FastMath.max(maxErrorLMa, FastMath.abs(lMa.value(dtDS).getPartialDerivative(1) - be.getLMaDot().getReal()));
        maxErrorLJu = FastMath.max(maxErrorLJu, FastMath.abs(lJu.value(dtDS).getPartialDerivative(1) - be.getLJuDot().getReal()));
        maxErrorLSa = FastMath.max(maxErrorLSa, FastMath.abs(lSa.value(dtDS).getPartialDerivative(1) - be.getLSaDot().getReal()));
        maxErrorLUr = FastMath.max(maxErrorLUr, FastMath.abs(lUr.value(dtDS).getPartialDerivative(1) - be.getLUrDot().getReal()));
        maxErrorLNe = FastMath.max(maxErrorLNe, FastMath.abs(lNe.value(dtDS).getPartialDerivative(1) - be.getLNeDot().getReal()));
        maxErrorPa = FastMath.max(maxErrorPa, FastMath.abs(pa.value(dtDS).getPartialDerivative(1) - be.getPaDot().getReal()));
    }
    Assert.assertEquals(0, maxErrorGamma, 8.0e-13);
    Assert.assertEquals(0, maxErrorL, 1.0e-14);
    Assert.assertEquals(0, maxErrorLPrime, 6.0e-16);
    Assert.assertEquals(0, maxErrorF, 6.0e-15);
    Assert.assertEquals(0, maxErrorD, 6.0e-15);
    Assert.assertEquals(0, maxErrorLMe, 2.0e-15);
    Assert.assertEquals(0, maxErrorLVe, 5.0e-16);
    Assert.assertEquals(0, maxErrorLE, 3.0e-16);
    Assert.assertEquals(0, maxErrorLMa, 4.0e-16);
    Assert.assertEquals(0, maxErrorLJu, 3.0e-17);
    Assert.assertEquals(0, maxErrorLSa, 4.0e-17);
    Assert.assertEquals(0, maxErrorLUr, 1.0e-16);
    Assert.assertEquals(0, maxErrorLNe, 8.0e-17);
    Assert.assertEquals(0, maxErrorPa, 3.0e-20);
}
Also used : IERSConventions(org.orekit.utils.IERSConventions) Decimal64(org.hipparchus.util.Decimal64) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) TimeScale(org.orekit.time.TimeScale) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) Test(org.junit.Test)

Example 8 with IERSConventions

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

the class FundamentalNutationArgumentsTest method testSerializationTidalCorrection.

@Test
public void testSerializationTidalCorrection() throws OrekitException, IOException, ClassNotFoundException {
    IERSConventions conventions = IERSConventions.IERS_2010;
    TimeScale ut1 = TimeScalesFactory.getUT1(conventions, false);
    checkSerialization(295000, 300000, conventions.getNutationArguments(ut1));
}
Also used : IERSConventions(org.orekit.utils.IERSConventions) TimeScale(org.orekit.time.TimeScale) Test(org.junit.Test)

Example 9 with IERSConventions

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

the class FundamentalNutationArgumentsTest method testDotDouble.

@Test
public void testDotDouble() throws OrekitException {
    final IERSConventions conventions = IERSConventions.IERS_2010;
    final TimeScale ut1 = TimeScalesFactory.getUT1(conventions, false);
    final FundamentalNutationArguments fna = conventions.getNutationArguments(ut1);
    final AbsoluteDate t0 = new AbsoluteDate(2002, 4, 7, 12, 34, 22.5, TimeScalesFactory.getUTC());
    final UnivariateDifferentiableFunction gamma = differentiate(fna, t0, b -> b.getGamma());
    final UnivariateDifferentiableFunction l = differentiate(fna, t0, b -> b.getL());
    final UnivariateDifferentiableFunction lPrime = differentiate(fna, t0, b -> b.getLPrime());
    final UnivariateDifferentiableFunction f = differentiate(fna, t0, b -> b.getF());
    final UnivariateDifferentiableFunction d = differentiate(fna, t0, b -> b.getD());
    final UnivariateDifferentiableFunction lMe = differentiate(fna, t0, b -> b.getLMe());
    final UnivariateDifferentiableFunction lVe = differentiate(fna, t0, b -> b.getLVe());
    final UnivariateDifferentiableFunction lE = differentiate(fna, t0, b -> b.getLE());
    final UnivariateDifferentiableFunction lMa = differentiate(fna, t0, b -> b.getLMa());
    final UnivariateDifferentiableFunction lJu = differentiate(fna, t0, b -> b.getLJu());
    final UnivariateDifferentiableFunction lSa = differentiate(fna, t0, b -> b.getLSa());
    final UnivariateDifferentiableFunction lUr = differentiate(fna, t0, b -> b.getLUr());
    final UnivariateDifferentiableFunction lNe = differentiate(fna, t0, b -> b.getLNe());
    final UnivariateDifferentiableFunction pa = differentiate(fna, t0, b -> b.getPa());
    final DSFactory factory = new DSFactory(1, 1);
    double maxErrorGamma = 0;
    double maxErrorL = 0;
    double maxErrorLPrime = 0;
    double maxErrorF = 0;
    double maxErrorD = 0;
    double maxErrorLMe = 0;
    double maxErrorLVe = 0;
    double maxErrorLE = 0;
    double maxErrorLMa = 0;
    double maxErrorLJu = 0;
    double maxErrorLSa = 0;
    double maxErrorLUr = 0;
    double maxErrorLNe = 0;
    double maxErrorPa = 0;
    for (double dt = 0; dt < Constants.JULIAN_DAY; dt += 60.0) {
        BodiesElements be = fna.evaluateAll(t0.shiftedBy(dt));
        DerivativeStructure dtDS = factory.variable(0, dt);
        maxErrorGamma = FastMath.max(maxErrorGamma, FastMath.abs(gamma.value(dtDS).getPartialDerivative(1) - be.getGammaDot()));
        maxErrorL = FastMath.max(maxErrorL, FastMath.abs(l.value(dtDS).getPartialDerivative(1) - be.getLDot()));
        maxErrorLPrime = FastMath.max(maxErrorLPrime, FastMath.abs(lPrime.value(dtDS).getPartialDerivative(1) - be.getLPrimeDot()));
        maxErrorF = FastMath.max(maxErrorF, FastMath.abs(f.value(dtDS).getPartialDerivative(1) - be.getFDot()));
        maxErrorD = FastMath.max(maxErrorD, FastMath.abs(d.value(dtDS).getPartialDerivative(1) - be.getDDot()));
        maxErrorLMe = FastMath.max(maxErrorLMe, FastMath.abs(lMe.value(dtDS).getPartialDerivative(1) - be.getLMeDot()));
        maxErrorLVe = FastMath.max(maxErrorLVe, FastMath.abs(lVe.value(dtDS).getPartialDerivative(1) - be.getLVeDot()));
        maxErrorLE = FastMath.max(maxErrorLE, FastMath.abs(lE.value(dtDS).getPartialDerivative(1) - be.getLEDot()));
        maxErrorLMa = FastMath.max(maxErrorLMa, FastMath.abs(lMa.value(dtDS).getPartialDerivative(1) - be.getLMaDot()));
        maxErrorLJu = FastMath.max(maxErrorLJu, FastMath.abs(lJu.value(dtDS).getPartialDerivative(1) - be.getLJuDot()));
        maxErrorLSa = FastMath.max(maxErrorLSa, FastMath.abs(lSa.value(dtDS).getPartialDerivative(1) - be.getLSaDot()));
        maxErrorLUr = FastMath.max(maxErrorLUr, FastMath.abs(lUr.value(dtDS).getPartialDerivative(1) - be.getLUrDot()));
        maxErrorLNe = FastMath.max(maxErrorLNe, FastMath.abs(lNe.value(dtDS).getPartialDerivative(1) - be.getLNeDot()));
        maxErrorPa = FastMath.max(maxErrorPa, FastMath.abs(pa.value(dtDS).getPartialDerivative(1) - be.getPaDot()));
    }
    Assert.assertEquals(0, maxErrorGamma, 8.0e-13);
    Assert.assertEquals(0, maxErrorL, 1.0e-14);
    Assert.assertEquals(0, maxErrorLPrime, 6.0e-16);
    Assert.assertEquals(0, maxErrorF, 6.0e-15);
    Assert.assertEquals(0, maxErrorD, 6.0e-15);
    Assert.assertEquals(0, maxErrorLMe, 2.0e-15);
    Assert.assertEquals(0, maxErrorLVe, 5.0e-16);
    Assert.assertEquals(0, maxErrorLE, 3.0e-16);
    Assert.assertEquals(0, maxErrorLMa, 4.0e-16);
    Assert.assertEquals(0, maxErrorLJu, 3.0e-17);
    Assert.assertEquals(0, maxErrorLSa, 4.0e-17);
    Assert.assertEquals(0, maxErrorLUr, 1.0e-16);
    Assert.assertEquals(0, maxErrorLNe, 8.0e-17);
    Assert.assertEquals(0, maxErrorPa, 3.0e-20);
}
Also used : IERSConventions(org.orekit.utils.IERSConventions) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) TimeScale(org.orekit.time.TimeScale) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 10 with IERSConventions

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

the class FundamentalNutationArgumentsTest method testSerializationNoTidalCorrection.

@Test
public void testSerializationNoTidalCorrection() throws OrekitException, IOException, ClassNotFoundException {
    IERSConventions conventions = IERSConventions.IERS_2010;
    TimeScale ut1 = TimeScalesFactory.getUT1(conventions, true);
    checkSerialization(295000, 300000, conventions.getNutationArguments(ut1));
}
Also used : IERSConventions(org.orekit.utils.IERSConventions) TimeScale(org.orekit.time.TimeScale) Test(org.junit.Test)

Aggregations

IERSConventions (org.orekit.utils.IERSConventions)19 Test (org.junit.Test)11 AbsoluteDate (org.orekit.time.AbsoluteDate)8 NormalizedSphericalHarmonicsProvider (org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider)7 TimeScale (org.orekit.time.TimeScale)7 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)6 Orbit (org.orekit.orbits.Orbit)6 ArrayList (java.util.ArrayList)5 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)5 Frame (org.orekit.frames.Frame)5 FileInputStream (java.io.FileInputStream)4 GeodeticPoint (org.orekit.bodies.GeodeticPoint)4 CartesianOrbit (org.orekit.orbits.CartesianOrbit)4 CircularOrbit (org.orekit.orbits.CircularOrbit)4 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)4 NumericalPropagatorBuilder (org.orekit.propagation.conversion.NumericalPropagatorBuilder)4 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)4 File (java.io.File)3 AngularAzEl (org.orekit.estimation.measurements.AngularAzEl)3 EstimatedMeasurement (org.orekit.estimation.measurements.EstimatedMeasurement)3