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);
}
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);
}
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());
}
}
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())));
}
}
}
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);
}
Aggregations