Search in sources :

Example 21 with TimeScale

use of org.orekit.time.TimeScale in project Orekit by CS-SI.

the class IERSConventionsTest method testGMST00FieldConsistency.

@Test
public void testGMST00FieldConsistency() throws OrekitException {
    final TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_2003, true);
    checkScalarFunctionConsistency(IERSConventions.IERS_2003.getGMSTFunction(ut1), AbsoluteDate.J2000_EPOCH.shiftedBy(-0.4 * Constants.JULIAN_DAY), 0.8 * Constants.JULIAN_DAY, 600.0, 10.0, 2.0e-15, 8.0e-13);
}
Also used : TimeScale(org.orekit.time.TimeScale) Test(org.junit.Test)

Example 22 with TimeScale

use of org.orekit.time.TimeScale in project Orekit by CS-SI.

the class IERSConventionsTest method testERA1996FieldConsistency.

@Test
public void testERA1996FieldConsistency() throws OrekitException {
    final TimeScale ut1 = TimeScalesFactory.getUT1(IERSConventions.IERS_1996, true);
    checkScalarFunctionConsistency(IERSConventions.IERS_1996.getEarthOrientationAngleFunction(ut1), AbsoluteDate.J2000_EPOCH.shiftedBy(-0.4 * Constants.JULIAN_DAY), 0.8 * Constants.JULIAN_DAY, 1800.0, 10.0, 2.0e-15, 8.0e-13);
}
Also used : TimeScale(org.orekit.time.TimeScale) Test(org.junit.Test)

Example 23 with TimeScale

use of org.orekit.time.TimeScale in project Orekit by CS-SI.

the class Time1 method main.

/**
 * Program entry point.
 * @param args program arguments (unused here)
 */
public static void main(String[] args) {
    try {
        // configure Orekit
        File home = new File(System.getProperty("user.home"));
        File orekitData = new File(home, "orekit-data");
        if (!orekitData.exists()) {
            System.err.format(Locale.US, "Failed to find %s folder%n", orekitData.getAbsolutePath());
            System.err.format(Locale.US, "You need to download %s from the %s page and unzip it in %s for this tutorial to work%n", "orekit-data.zip", "https://www.orekit.org/forge/projects/orekit/files", home.getAbsolutePath());
            System.exit(1);
        }
        DataProvidersManager manager = DataProvidersManager.getInstance();
        manager.addProvider(new DirectoryCrawler(orekitData));
        // get the UTC and TAI time scales
        TimeScale utc = TimeScalesFactory.getUTC();
        TimeScale tai = TimeScalesFactory.getTAI();
        // create a start date from its calendar components in UTC time scale
        AbsoluteDate start = new AbsoluteDate(2005, 12, 31, 23, 59, 50, utc);
        // create an end date 20 seconds after the start date
        double duration = 20.0;
        AbsoluteDate end = start.shiftedBy(duration);
        // output header line
        System.out.println("        UTC date                  TAI date");
        // loop from start to end using a one minute step
        // (a leap second was introduced this day, so the display should show
        // the rare case of an UTC minute with more than 60 seconds)
        double step = 0.5;
        for (AbsoluteDate date = start; date.compareTo(end) < 0; date = date.shiftedBy(step)) {
            System.out.println(date.toString(utc) + "   " + date.toString(tai));
        }
    } catch (OrekitException oe) {
        System.err.println(oe.getMessage());
    }
}
Also used : DirectoryCrawler(org.orekit.data.DirectoryCrawler) DataProvidersManager(org.orekit.data.DataProvidersManager) OrekitException(org.orekit.errors.OrekitException) File(java.io.File) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate)

Example 24 with TimeScale

use of org.orekit.time.TimeScale in project Orekit by CS-SI.

the class TrackCorridor method run.

private void run(final File input, final File output, final String separator) throws IOException, IllegalArgumentException, OrekitException {
    // read input parameters
    KeyValueFileParser<ParameterKey> parser = new KeyValueFileParser<ParameterKey>(ParameterKey.class);
    try (final FileInputStream fis = new FileInputStream(input)) {
        parser.parseInput(input.getAbsolutePath(), fis);
    }
    TimeScale utc = TimeScalesFactory.getUTC();
    Propagator propagator;
    if (parser.containsKey(ParameterKey.TLE_LINE1)) {
        propagator = createPropagator(parser.getString(ParameterKey.TLE_LINE1), parser.getString(ParameterKey.TLE_LINE2));
    } else {
        propagator = createPropagator(parser.getDate(ParameterKey.ORBIT_CIRCULAR_DATE, utc), parser.getDouble(ParameterKey.ORBIT_CIRCULAR_A), parser.getDouble(ParameterKey.ORBIT_CIRCULAR_EX), parser.getDouble(ParameterKey.ORBIT_CIRCULAR_EY), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_I), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_RAAN), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_ALPHA));
    }
    // simulation properties
    AbsoluteDate start = parser.getDate(ParameterKey.START_DATE, utc);
    double duration = parser.getDouble(ParameterKey.DURATION);
    double step = parser.getDouble(ParameterKey.STEP);
    double angle = parser.getAngle(ParameterKey.ANGULAR_OFFSET);
    // set up a handler to gather all corridor points
    CorridorHandler handler = new CorridorHandler(angle);
    propagator.setMasterMode(step, handler);
    // perform propagation, letting the step handler populate the corridor
    propagator.propagate(start, start.shiftedBy(duration));
    // retrieve the built corridor
    List<CorridorPoint> corridor = handler.getCorridor();
    // create a 7 columns csv file representing the corridor in the user home directory, with
    // date in column 1 (in ISO-8601 format)
    // left limit latitude in column 2 and left limit longitude in column 3
    // center track latitude in column 4 and center track longitude in column 5
    // right limit latitude in column 6 and right limit longitude in column 7
    DecimalFormat format = new DecimalFormat("#00.00000", new DecimalFormatSymbols(Locale.US));
    try (final PrintStream stream = new PrintStream(output, "UTF-8")) {
        for (CorridorPoint p : corridor) {
            stream.println(p.getDate() + separator + format.format(FastMath.toDegrees(p.getLeft().getLatitude())) + separator + format.format(FastMath.toDegrees(p.getLeft().getLongitude())) + separator + format.format(FastMath.toDegrees(p.getCenter().getLatitude())) + separator + format.format(FastMath.toDegrees(p.getCenter().getLongitude())) + separator + format.format(FastMath.toDegrees(p.getRight().getLatitude())) + separator + format.format(FastMath.toDegrees(p.getRight().getLongitude())));
        }
    }
}
Also used : PrintStream(java.io.PrintStream) KeyValueFileParser(fr.cs.examples.KeyValueFileParser) DecimalFormatSymbols(java.text.DecimalFormatSymbols) DecimalFormat(java.text.DecimalFormat) TimeScale(org.orekit.time.TimeScale) FileInputStream(java.io.FileInputStream) AbsoluteDate(org.orekit.time.AbsoluteDate) TLEPropagator(org.orekit.propagation.analytical.tle.TLEPropagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator)

Example 25 with TimeScale

use of org.orekit.time.TimeScale in project Orekit by CS-SI.

the class SolidTidesFieldTest method testInterpolationAccuracy.

@Test
public void testInterpolationAccuracy() throws OrekitException {
    // The shortest periods are slightly below one half day for the tidal waves
    // considered here. This implies the sampling rate should be fast enough.
    // The tuning parameters we have finally settled correspond to a two hours
    // sample containing 12 points (i.e. one new point is computed every 10 minutes).
    // The observed relative interpolation error with these settings are essentially
    // due to Runge phenomenon at points sampling rate. Plotting the errors shows
    // singular peaks pointing out of merely numerical noise.
    final IERSConventions conventions = IERSConventions.IERS_2010;
    Frame itrf = FramesFactory.getITRF(conventions, true);
    TimeScale utc = TimeScalesFactory.getUTC();
    UT1Scale ut1 = TimeScalesFactory.getUT1(conventions, true);
    NormalizedSphericalHarmonicsProvider gravityField = GravityFieldFactory.getConstantNormalizedProvider(5, 5);
    SolidTidesField raw = new SolidTidesField(conventions.getLoveNumbers(), conventions.getTideFrequencyDependenceFunction(ut1), conventions.getPermanentTide(), conventions.getSolidPoleTide(ut1.getEOPHistory()), itrf, gravityField.getAe(), gravityField.getMu(), gravityField.getTideSystem(), CelestialBodyFactory.getSun(), CelestialBodyFactory.getMoon());
    int step = 600;
    int nbPoints = 12;
    CachedNormalizedSphericalHarmonicsProvider interpolated = new CachedNormalizedSphericalHarmonicsProvider(raw, step, nbPoints, OrekitConfiguration.getCacheSlotsNumber(), 7 * Constants.JULIAN_DAY, 0.5 * Constants.JULIAN_DAY);
    // the following time range is located around the maximal observed error
    AbsoluteDate start = new AbsoluteDate(2003, 6, 12, utc);
    AbsoluteDate end = start.shiftedBy(3 * Constants.JULIAN_DAY);
    StreamingStatistics stat = new StreamingStatistics();
    for (AbsoluteDate date = start; date.compareTo(end) < 0; date = date.shiftedBy(60)) {
        NormalizedSphericalHarmonics rawHarmonics = raw.onDate(date);
        NormalizedSphericalHarmonics interpolatedHarmonics = interpolated.onDate(date);
        for (int n = 2; n < 5; ++n) {
            for (int m = 0; m <= n; ++m) {
                if (n < 4 || m < 3) {
                    double cnmRaw = rawHarmonics.getNormalizedCnm(n, m);
                    double cnmInterp = interpolatedHarmonics.getNormalizedCnm(n, m);
                    double errorC = (cnmInterp - cnmRaw) / FastMath.abs(cnmRaw);
                    stat.addValue(errorC);
                    if (m > 0) {
                        double snmRaw = rawHarmonics.getNormalizedSnm(n, m);
                        double snmInterp = interpolatedHarmonics.getNormalizedSnm(n, m);
                        double errorS = (snmInterp - snmRaw) / FastMath.abs(snmRaw);
                        stat.addValue(errorS);
                    }
                }
            }
        }
    }
    Assert.assertEquals(0.0, stat.getMean(), 2.0e-12);
    Assert.assertTrue(stat.getStandardDeviation() < 2.0e-9);
    Assert.assertTrue(stat.getMin() > -9.0e-8);
    Assert.assertTrue(stat.getMax() < 2.2e-7);
}
Also used : Frame(org.orekit.frames.Frame) UT1Scale(org.orekit.time.UT1Scale) StreamingStatistics(org.hipparchus.stat.descriptive.StreamingStatistics) IERSConventions(org.orekit.utils.IERSConventions) NormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider.NormalizedSphericalHarmonics) CachedNormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.CachedNormalizedSphericalHarmonicsProvider) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) CachedNormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.CachedNormalizedSphericalHarmonicsProvider) TimeScale(org.orekit.time.TimeScale) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

TimeScale (org.orekit.time.TimeScale)116 AbsoluteDate (org.orekit.time.AbsoluteDate)89 Test (org.junit.Test)75 Frame (org.orekit.frames.Frame)44 Orbit (org.orekit.orbits.Orbit)38 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)38 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)35 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)32 SpacecraftState (org.orekit.propagation.SpacecraftState)30 PVCoordinates (org.orekit.utils.PVCoordinates)28 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)25 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)17 OrekitException (org.orekit.errors.OrekitException)17 Propagator (org.orekit.propagation.Propagator)17 EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)15 BodiesElements (org.orekit.data.BodiesElements)14 FundamentalNutationArguments (org.orekit.data.FundamentalNutationArguments)14 CartesianOrbit (org.orekit.orbits.CartesianOrbit)14 FieldCartesianOrbit (org.orekit.orbits.FieldCartesianOrbit)14 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)13