use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class OrekitStepHandlerTest method testIsInterpolated.
/**
* Check {@link OrekitStepInterpolator#isPreviousStateInterpolated()} and {@link
* OrekitStepInterpolator#isCurrentStateInterpolated()}.
*
* @throws OrekitException on error.
*/
@Test
public void testIsInterpolated() throws OrekitException {
// setup
NumericalPropagator propagator = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(60));
AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
Frame eci = FramesFactory.getGCRF();
SpacecraftState ic = new SpacecraftState(new KeplerianOrbit(6378137 + 500e3, 1e-3, 0, 0, 0, 0, PositionAngle.TRUE, eci, date, Constants.EIGEN5C_EARTH_MU));
propagator.setInitialState(ic);
propagator.setOrbitType(OrbitType.CARTESIAN);
// detector triggers half way through second step
DateDetector detector = new DateDetector(date.shiftedBy(90)).withHandler(new ContinueOnEvent<>());
propagator.addEventDetector(detector);
// action and verify
Queue<Boolean> expected = new ArrayDeque<>(Arrays.asList(false, false, false, true, true, false));
propagator.setMasterMode(new OrekitStepHandler() {
@Override
public void handleStep(OrekitStepInterpolator interpolator, boolean isLast) {
assertEquals(expected.poll(), interpolator.isPreviousStateInterpolated());
assertEquals(expected.poll(), interpolator.isCurrentStateInterpolated());
}
});
final AbsoluteDate end = date.shiftedBy(120);
assertEquals(end, propagator.propagate(end).getDate());
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class FieldNodeDetector method estimateNodesTimeSeparation.
/**
* Find time separation between nodes.
* <p>
* The estimation of time separation is based on Keplerian motion, it is only
* used as a rough guess for a safe setting of default max check interval for
* event detection.
* </p>
* @param orbit initial orbit
* @return minimum time separation between nodes
*/
private static double estimateNodesTimeSeparation(final Orbit orbit) {
final KeplerianOrbit keplerian = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(orbit);
// mean anomaly of ascending node
final double ascendingM = new KeplerianOrbit(keplerian.getA(), keplerian.getE(), keplerian.getI(), keplerian.getPerigeeArgument(), keplerian.getRightAscensionOfAscendingNode(), -keplerian.getPerigeeArgument(), PositionAngle.TRUE, keplerian.getFrame(), keplerian.getDate(), keplerian.getMu()).getMeanAnomaly();
// mean anomaly of descending node
final double descendingM = new KeplerianOrbit(keplerian.getA(), keplerian.getE(), keplerian.getI(), keplerian.getPerigeeArgument(), keplerian.getRightAscensionOfAscendingNode(), FastMath.PI - keplerian.getPerigeeArgument(), PositionAngle.TRUE, keplerian.getFrame(), keplerian.getDate(), keplerian.getMu()).getMeanAnomaly();
// differences between mean anomalies
final double delta1 = MathUtils.normalizeAngle(ascendingM, descendingM + FastMath.PI) - descendingM;
final double delta2 = 2 * FastMath.PI - delta1;
// minimum time separation between the two nodes
return FastMath.min(delta1, delta2) / keplerian.getKeplerianMeanMotion();
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class TLEPropagatorBuilder method buildPropagator.
/**
* {@inheritDoc}
*/
public Propagator buildPropagator(final double[] normalizedParameters) throws OrekitException {
// create the orbit
setParameters(normalizedParameters);
final Orbit orbit = createInitialOrbit();
// we really need a Keplerian orbit type
final KeplerianOrbit kep = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(orbit);
final TLE tle = new TLE(satelliteNumber, classification, launchYear, launchNumber, launchPiece, TLE.DEFAULT, elementNumber, orbit.getDate(), kep.getKeplerianMeanMotion(), 0.0, 0.0, kep.getE(), MathUtils.normalizeAngle(orbit.getI(), FastMath.PI), MathUtils.normalizeAngle(kep.getPerigeeArgument(), FastMath.PI), MathUtils.normalizeAngle(kep.getRightAscensionOfAscendingNode(), FastMath.PI), MathUtils.normalizeAngle(kep.getMeanAnomaly(), FastMath.PI), revolutionNumberAtEpoch, bStar);
return TLEPropagator.selectExtrapolator(tle);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class RelativityTest method testSmallEffectOnOrbit.
/**
* check against example in Tapley, Schutz, and Born, p 65-66. They predict a
* progression of perigee of 11 arcsec/year. To get the same results we must set the
* propagation tolerances to 1e-5.
*
* @throws OrekitException on error
*/
@Test
public void testSmallEffectOnOrbit() throws OrekitException {
// setup
final double gm = Constants.EIGEN5C_EARTH_MU;
Orbit orbit = new KeplerianOrbit(7500e3, 0.025, FastMath.toRadians(41.2), 0, 0, 0, PositionAngle.TRUE, frame, date, gm);
double[][] tol = NumericalPropagator.tolerances(0.00001, orbit, OrbitType.CARTESIAN);
AbstractIntegrator integrator = new DormandPrince853Integrator(1, 3600, tol[0], tol[1]);
NumericalPropagator propagator = new NumericalPropagator(integrator);
propagator.setOrbitType(OrbitType.CARTESIAN);
propagator.addForceModel(new Relativity(gm));
propagator.setInitialState(new SpacecraftState(orbit));
// action: propagate a period
AbsoluteDate end = orbit.getDate().shiftedBy(30 * Constants.JULIAN_DAY);
PVCoordinates actual = propagator.getPVCoordinates(end, frame);
// verify
KeplerianOrbit endOrbit = new KeplerianOrbit(actual, frame, end, gm);
KeplerianOrbit startOrbit = new KeplerianOrbit(orbit);
double dp = endOrbit.getPerigeeArgument() - startOrbit.getPerigeeArgument();
double dtYears = end.durationFrom(orbit.getDate()) / Constants.JULIAN_YEAR;
double dpDeg = FastMath.toDegrees(dp);
// change in argument of perigee in arcseconds per year
double arcsecPerYear = dpDeg * 3600 / dtYears;
Assert.assertEquals(11, arcsecPerYear, 0.5);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class SolidTidesTest method testTideEffect1996.
@Test
public void testTideEffect1996() throws OrekitException {
Frame eme2000 = FramesFactory.getEME2000();
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate date = new AbsoluteDate(2003, 07, 01, 13, 59, 27.816, utc);
Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, FastMath.toRadians(98.7), FastMath.toRadians(93.0), FastMath.toRadians(15.0 * 22.5), 0, PositionAngle.MEAN, eme2000, date, Constants.EIGEN5C_EARTH_MU);
doTestTideEffect(orbit, IERSConventions.IERS_1996, 44.09481, 0.00000);
}
Aggregations