use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class EventDetectorTest method testDefaultMethods.
@Test
public void testDefaultMethods() throws OrekitException {
EventDetector dummyDetector = new EventDetector() {
private static final long serialVersionUID = 1L;
@Override
public double getThreshold() {
return 1.0e-10;
}
@Override
public int getMaxIterationCount() {
return 100;
}
@Override
public double getMaxCheckInterval() {
return 60;
}
@Override
public double g(SpacecraftState s) {
return s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH);
}
@Override
public Action eventOccurred(SpacecraftState s, boolean increasing) {
return Action.RESET_STATE;
}
};
// by default, this method does nothing, so this should pass without exception
dummyDetector.init(null, null);
// by default, this method returns its argument
SpacecraftState s = new SpacecraftState(new KeplerianOrbit(7e6, 0.01, 0.3, 0, 0, 0, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU));
Assert.assertSame(s, dummyDetector.resetState(s));
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class FieldOfViewTest method testRollPitchYawHexagonalFootprint.
@Test
public void testRollPitchYawHexagonalFootprint() throws OrekitException {
Utils.setDataRoot("regular-data");
FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, FastMath.toRadians(3.0), 6, 0.0);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
KeplerianOrbit orbit = new KeplerianOrbit(new PVCoordinates(new Vector3D(7.0e6, 1.0e6, 4.0e6), new Vector3D(-500.0, 8000.0, 1000.0)), FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new KeplerianPropagator(orbit);
propagator.setAttitudeProvider(new LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(10), FastMath.toRadians(20), FastMath.toRadians(5)));
SpacecraftState state = propagator.propagate(orbit.getDate().shiftedBy(1000.0));
Transform inertToBody = state.getFrame().getTransformTo(earth.getBodyFrame(), state.getDate());
Transform fovToBody = new Transform(state.getDate(), state.toTransform().getInverse(), inertToBody);
List<List<GeodeticPoint>> footprint = fov.getFootprint(fovToBody, earth, FastMath.toRadians(0.1));
Vector3D subSat = earth.projectToGround(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), state.getDate(), earth.getBodyFrame());
Assert.assertEquals(1, footprint.size());
List<GeodeticPoint> loop = footprint.get(0);
Assert.assertEquals(210, loop.size());
double minEl = Double.POSITIVE_INFINITY;
double maxEl = 0;
double minDist = Double.POSITIVE_INFINITY;
double maxDist = 0;
for (int i = 0; i < loop.size(); ++i) {
Assert.assertEquals(0.0, loop.get(i).getAltitude(), 1.0e-15);
TopocentricFrame topo = new TopocentricFrame(earth, loop.get(i), "atLimb");
final double elevation = topo.getElevation(state.getPVCoordinates().getPosition(), state.getFrame(), state.getDate());
minEl = FastMath.min(minEl, elevation);
maxEl = FastMath.max(maxEl, elevation);
final double dist = Vector3D.distance(subSat, earth.transform(loop.get(i)));
minDist = FastMath.min(minDist, dist);
maxDist = FastMath.max(maxDist, dist);
}
Assert.assertEquals(48.0026, FastMath.toDegrees(minEl), 0.001);
Assert.assertEquals(60.1975, FastMath.toDegrees(maxEl), 0.001);
Assert.assertEquals(1221543.6, minDist, 1.0);
Assert.assertEquals(1804921.6, maxDist, 1.0);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class FieldOfViewTest method testFOVPartiallyTruncatedAtLimb.
@Test
public void testFOVPartiallyTruncatedAtLimb() throws OrekitException {
Utils.setDataRoot("regular-data");
FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, FastMath.toRadians(40.0), 6, 0.0);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
KeplerianOrbit orbit = new KeplerianOrbit(new PVCoordinates(new Vector3D(7.0e6, 1.0e6, 4.0e6), new Vector3D(-500.0, 8000.0, 1000.0)), FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new KeplerianPropagator(orbit);
propagator.setAttitudeProvider(new NadirPointing(orbit.getFrame(), earth));
SpacecraftState state = propagator.propagate(orbit.getDate().shiftedBy(1000.0));
Transform inertToBody = state.getFrame().getTransformTo(earth.getBodyFrame(), state.getDate());
Transform fovToBody = new Transform(state.getDate(), state.toTransform().getInverse(), inertToBody);
List<List<GeodeticPoint>> footprint = fov.getFootprint(fovToBody, earth, FastMath.toRadians(1.0));
Vector3D subSat = earth.projectToGround(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), state.getDate(), earth.getBodyFrame());
Assert.assertEquals(1, footprint.size());
List<GeodeticPoint> loop = footprint.get(0);
Assert.assertEquals(246, loop.size());
double minEl = Double.POSITIVE_INFINITY;
double maxEl = 0;
double minDist = Double.POSITIVE_INFINITY;
double maxDist = 0;
for (int i = 0; i < loop.size(); ++i) {
Assert.assertEquals(0.0, loop.get(i).getAltitude(), 3.0e-7);
TopocentricFrame topo = new TopocentricFrame(earth, loop.get(i), "atLimb");
final double elevation = topo.getElevation(state.getPVCoordinates().getPosition(), state.getFrame(), state.getDate());
minEl = FastMath.min(minEl, elevation);
maxEl = FastMath.max(maxEl, elevation);
final double dist = Vector3D.distance(subSat, earth.transform(loop.get(i)));
minDist = FastMath.min(minDist, dist);
maxDist = FastMath.max(maxDist, dist);
}
Assert.assertEquals(0.0, FastMath.toDegrees(minEl), 2.0e-12);
Assert.assertEquals(7.8897, FastMath.toDegrees(maxEl), 0.001);
Assert.assertEquals(4584829.6, minDist, 1.0);
Assert.assertEquals(5347029.8, maxDist, 1.0);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class FieldOfViewTest method testFOVAwayFromEarth.
@Test
public void testFOVAwayFromEarth() throws OrekitException {
Utils.setDataRoot("regular-data");
FieldOfView fov = new FieldOfView(Vector3D.MINUS_K, Vector3D.PLUS_I, FastMath.toRadians(3.0), 6, 0.0);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
KeplerianOrbit orbit = new KeplerianOrbit(new PVCoordinates(new Vector3D(7.0e6, 1.0e6, 4.0e6), new Vector3D(-500.0, 8000.0, 1000.0)), FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new KeplerianPropagator(orbit);
propagator.setAttitudeProvider(new NadirPointing(orbit.getFrame(), earth));
SpacecraftState state = propagator.propagate(orbit.getDate().shiftedBy(1000.0));
Transform inertToBody = state.getFrame().getTransformTo(earth.getBodyFrame(), state.getDate());
Transform fovToBody = new Transform(state.getDate(), state.toTransform().getInverse(), inertToBody);
List<List<GeodeticPoint>> footprint = fov.getFootprint(fovToBody, earth, FastMath.toRadians(1.0));
Assert.assertEquals(0, footprint.size());
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class ApsideDetectorTest method testSimple.
@Test
public void testSimple() throws OrekitException {
EventDetector detector = new ApsideDetector(propagator.getInitialState().getOrbit()).withMaxCheck(600.0).withThreshold(1.0e-12).withHandler(new ContinueOnEvent<ApsideDetector>());
Assert.assertEquals(600.0, detector.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-12, detector.getThreshold(), 1.0e-15);
Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, detector.getMaxIterationCount());
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(detector));
propagator.propagate(propagator.getInitialState().getOrbit().getDate().shiftedBy(Constants.JULIAN_DAY));
Assert.assertEquals(30, logger.getLoggedEvents().size());
for (LoggedEvent e : logger.getLoggedEvents()) {
KeplerianOrbit o = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(e.getState().getOrbit());
double expected = e.isIncreasing() ? 0.0 : FastMath.PI;
Assert.assertEquals(expected, MathUtils.normalizeAngle(o.getMeanAnomaly(), expected), 4.0e-14);
}
}
Aggregations