use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testAcceleration.
@Test
public void testAcceleration() throws OrekitException {
final KeplerianOrbit orbit = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, provider);
AbsoluteDate target = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
for (double dt : Arrays.asList(-0.5, 0.0, 0.5)) {
sample.add(propagator.propagate(target.shiftedBy(dt)).getPVCoordinates());
}
TimeStampedPVCoordinates interpolated = TimeStampedPVCoordinates.interpolate(target, CartesianDerivativesFilter.USE_P, sample);
Vector3D computedP = sample.get(1).getPosition();
Vector3D computedV = sample.get(1).getVelocity();
Vector3D referenceP = interpolated.getPosition();
Vector3D referenceV = interpolated.getVelocity();
Vector3D computedA = sample.get(1).getAcceleration();
Vector3D referenceA = interpolated.getAcceleration();
final CircularOrbit propagated = (CircularOrbit) OrbitType.CIRCULAR.convertType(propagator.propagateOrbit(target));
final CircularOrbit keplerian = new CircularOrbit(propagated.getA(), propagated.getCircularEx(), propagated.getCircularEy(), propagated.getI(), propagated.getRightAscensionOfAscendingNode(), propagated.getAlphaM(), PositionAngle.MEAN, propagated.getFrame(), propagated.getDate(), propagated.getMu());
Vector3D keplerianP = keplerian.getPVCoordinates().getPosition();
Vector3D keplerianV = keplerian.getPVCoordinates().getVelocity();
Vector3D keplerianA = keplerian.getPVCoordinates().getAcceleration();
// perturbed orbit position should be similar to Keplerian orbit position
Assert.assertEquals(0.0, Vector3D.distance(referenceP, computedP), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(referenceP, keplerianP), 4.0e-9);
// perturbed orbit velocity should be equal to Keplerian orbit because
// it was in fact reconstructed from Cartesian coordinates
double computationErrorV = Vector3D.distance(referenceV, computedV);
double nonKeplerianEffectV = Vector3D.distance(referenceV, keplerianV);
Assert.assertEquals(nonKeplerianEffectV, computationErrorV, 9.0e-13);
Assert.assertEquals(2.2e-4, computationErrorV, 3.0e-6);
// perturbed orbit acceleration should be different from Keplerian orbit because
// Keplerian orbit doesn't take orbit shape changes into account
// perturbed orbit acceleration should be consistent with position evolution
double computationErrorA = Vector3D.distance(referenceA, computedA);
double nonKeplerianEffectA = Vector3D.distance(referenceA, keplerianA);
Assert.assertEquals(1.0e-7, computationErrorA, 6.0e-9);
Assert.assertEquals(6.37e-3, nonKeplerianEffectA, 7.0e-6);
Assert.assertTrue(computationErrorA < nonKeplerianEffectA / 60000);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class KeplerianPropagatorTest method testIssue107.
@Test
public void testIssue107() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
Propagator propagator = new KeplerianPropagator(orbit) {
private static final long serialVersionUID = 1L;
AbsoluteDate lastDate = AbsoluteDate.PAST_INFINITY;
protected SpacecraftState basicPropagate(final AbsoluteDate date) throws OrekitException {
if (date.compareTo(lastDate) < 0) {
throw new OrekitException(LocalizedCoreFormats.SIMPLE_MESSAGE, "no backward propagation allowed");
}
lastDate = date;
return super.basicPropagate(date);
}
};
SpacecraftState finalState = propagator.propagate(date.shiftedBy(3600.0));
Assert.assertEquals(3600.0, finalState.getDate().durationFrom(date), 1.0e-15);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class OsculatingToMeanElementsConverterTest method testTrivial.
@Test
public void testTrivial() throws Exception {
final AbsoluteDate date = new AbsoluteDate("2011-12-12T11:57:20.000", TimeScalesFactory.getUTC());
final Orbit orbit1 = new CircularOrbit(7204535.848109436, -4.484755873986251E-4, 0.0011562979012178316, FastMath.toRadians(98.74341600466741), FastMath.toRadians(43.32990110790338), FastMath.toRadians(180.0), PositionAngle.MEAN, FramesFactory.getGCRF(), date, Constants.WGS84_EARTH_MU);
final SpacecraftState initialState = new SpacecraftState(orbit1);
// Set up the numerical propagator
final double[][] tol = NumericalPropagator.tolerances(1.0, initialState.getOrbit(), initialState.getOrbit().getType());
final double minStep = 1.;
final double maxStep = 200.;
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]);
integrator.setInitialStepSize(100.);
final NumericalPropagator prop = new NumericalPropagator(integrator);
prop.setInitialState(initialState);
final OsculatingToMeanElementsConverter converter = new OsculatingToMeanElementsConverter(initialState, 2, prop, 1.0);
final SpacecraftState meanOrbit = converter.convert();
final double eps = 1.e-15;
Assert.assertEquals(orbit1.getA(), meanOrbit.getA(), eps * orbit1.getA());
Assert.assertEquals(orbit1.getEquinoctialEx(), meanOrbit.getEquinoctialEx(), eps);
Assert.assertEquals(orbit1.getEquinoctialEy(), meanOrbit.getEquinoctialEy(), eps);
Assert.assertEquals(orbit1.getHx(), meanOrbit.getHx(), eps);
Assert.assertEquals(orbit1.getHy(), meanOrbit.getHy(), eps);
Assert.assertEquals(MathUtils.normalizeAngle(orbit1.getLM(), FastMath.PI), MathUtils.normalizeAngle(meanOrbit.getLM(), FastMath.PI), eps);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class EventDetectorTest method testIssue108Numerical.
@Test
public void testIssue108Numerical() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
final double step = 60.0;
final int n = 100;
NumericalPropagator propagator = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(step));
propagator.resetInitialState(new SpacecraftState(orbit));
GCallsCounter counter = new GCallsCounter(100000.0, 1.0e-6, 20, new StopOnEvent<GCallsCounter>());
propagator.addEventDetector(counter);
propagator.propagate(date.shiftedBy(n * step));
Assert.assertEquals(n + 1, counter.getCount());
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class EventDetectorTest method testBasicScheduling.
@Test
public void testBasicScheduling() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
Propagator propagator = new KeplerianPropagator(orbit);
double stepSize = 60.0;
OutOfOrderChecker checker = new OutOfOrderChecker(stepSize);
propagator.addEventDetector(new DateDetector(date.shiftedBy(5.25 * stepSize)).withHandler(checker));
propagator.setMasterMode(stepSize, checker);
propagator.propagate(date.shiftedBy(10 * stepSize));
Assert.assertTrue(checker.outOfOrderCallDetected());
}
Aggregations