use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class BackAndForthDetectorTest method testBackAndForth.
@Test
public void testBackAndForth() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final AbsoluteDate date0 = new AbsoluteDate(2006, 12, 27, 12, 0, 0.0, utc);
final AbsoluteDate date1 = new AbsoluteDate(2006, 12, 27, 22, 50, 0.0, utc);
final AbsoluteDate date2 = new AbsoluteDate(2006, 12, 27, 22, 58, 0.0, utc);
// Orbit
final double a = 7274000.;
final double e = 0.00127;
final double i = FastMath.toRadians(90.);
final double w = FastMath.toRadians(0.);
final double raan = FastMath.toRadians(12.5);
final double lM = FastMath.toRadians(60.);
Orbit iniOrb = new KeplerianOrbit(a, e, i, w, raan, lM, PositionAngle.MEAN, FramesFactory.getEME2000(), date0, Constants.WGS84_EARTH_MU);
// Propagator
KeplerianPropagator propagator = new KeplerianPropagator(iniOrb);
// Station
final GeodeticPoint stationPosition = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(100.), 110.);
final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
final TopocentricFrame stationFrame = new TopocentricFrame(earth, stationPosition, "");
// Detector
final Visibility visi = new Visibility();
propagator.addEventDetector(new ElevationDetector(stationFrame).withConstantElevation(FastMath.toRadians(10.)).withHandler(visi));
// Forward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date2);
// Backward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date0);
Assert.assertEquals(4, visi.getVisiNb());
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class NodeDetectorTest method testIssue158.
@Test
public void testIssue158() throws OrekitException {
double a = 3.0e7;
double e1 = 0.8;
double e2 = 1.0e-4;
double i = 1.0;
double pa = 1.5 * FastMath.PI;
double raan = 5.0;
double m = 0;
AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
Frame frame = FramesFactory.getEME2000();
double mu = Constants.EIGEN5C_EARTH_MU;
// highly eccentric, inclined orbit
final KeplerianOrbit orbit1 = new KeplerianOrbit(a, e1, i, pa, raan, m, PositionAngle.MEAN, frame, date, mu);
EventDetector detector1 = new NodeDetector(orbit1, orbit1.getFrame());
double t1 = orbit1.getKeplerianPeriod();
Assert.assertEquals(t1 / 28.82, detector1.getMaxCheckInterval(), t1 / 10000);
// nearly circular, inclined orbit
final KeplerianOrbit orbit2 = new KeplerianOrbit(a, e2, i, pa, raan, m, PositionAngle.MEAN, frame, date, mu);
EventDetector detector2 = new NodeDetector(orbit2, orbit2.getFrame());
double t2 = orbit2.getKeplerianPeriod();
Assert.assertEquals(t1, t2, t1 / 10000);
Assert.assertEquals(t2 / 3, detector2.getMaxCheckInterval(), t2 / 10000);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class NodeDetectorTest method testIssue138.
@Test
public void testIssue138() throws OrekitException {
double a = 800000 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
double e = 0.0001;
double i = FastMath.toRadians(98);
double w = -90;
double raan = 0;
double v = 0;
Frame inertialFrame = FramesFactory.getEME2000();
AbsoluteDate initialDate = new AbsoluteDate(2014, 01, 01, 0, 0, 0, TimeScalesFactory.getUTC());
AbsoluteDate finalDate = initialDate.shiftedBy(5000);
KeplerianOrbit initialOrbit = new KeplerianOrbit(a, e, i, w, raan, v, PositionAngle.TRUE, inertialFrame, initialDate, Constants.WGS84_EARTH_MU);
SpacecraftState initialState = new SpacecraftState(initialOrbit, 1000);
double[][] tol = NumericalPropagator.tolerances(10, initialOrbit, initialOrbit.getType());
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
NumericalPropagator propagator = new NumericalPropagator(integrator);
propagator.setInitialState(initialState);
// Define 2 instances of NodeDetector:
EventDetector rawDetector = new NodeDetector(1e-6, initialState.getOrbit(), initialState.getFrame()).withHandler(new ContinueOnEvent<NodeDetector>());
EventsLogger logger1 = new EventsLogger();
EventDetector node1 = logger1.monitorDetector(rawDetector);
EventsLogger logger2 = new EventsLogger();
EventDetector node2 = logger2.monitorDetector(rawDetector);
propagator.addEventDetector(node1);
propagator.addEventDetector(node2);
// First propagation
propagator.setEphemerisMode();
propagator.propagate(finalDate);
Assert.assertEquals(2, logger1.getLoggedEvents().size());
Assert.assertEquals(2, logger2.getLoggedEvents().size());
logger1.clearLoggedEvents();
logger2.clearLoggedEvents();
BoundedPropagator postpro = propagator.getGeneratedEphemeris();
// Post-processing
postpro.addEventDetector(node1);
postpro.addEventDetector(node2);
postpro.propagate(finalDate);
Assert.assertEquals(2, logger1.getLoggedEvents().size());
Assert.assertEquals(2, logger2.getLoggedEvents().size());
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class ContinueOnEventTest method testDecreasing.
@Test
public void testDecreasing() throws OrekitException {
SpacecraftState s = new SpacecraftState(new KeplerianOrbit(24464560.0, 0.7311, 0.122138, 3.10686, 1.00681, 0.048363, PositionAngle.MEAN, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU));
Assert.assertSame(EventHandler.Action.CONTINUE, new ContinueOnEvent<EventDetector>().eventOccurred(s, null, false));
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class StopOnDecreasingTest method testDecreasing.
@Test
public void testDecreasing() throws OrekitException {
SpacecraftState s = new SpacecraftState(new KeplerianOrbit(24464560.0, 0.7311, 0.122138, 3.10686, 1.00681, 0.048363, PositionAngle.MEAN, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU));
Assert.assertSame(EventHandler.Action.STOP, new StopOnDecreasing<EventDetector>().eventOccurred(s, null, false));
}
Aggregations