use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class ImpulseManeuverTest method testBackward.
@Test
public void testBackward() throws OrekitException {
final AbsoluteDate iniDate = new AbsoluteDate(2003, 5, 1, 17, 30, 0.0, TimeScalesFactory.getUTC());
final Orbit initialOrbit = new KeplerianOrbit(7e6, 1.0e-4, FastMath.toRadians(98.5), FastMath.toRadians(87.0), FastMath.toRadians(216.1807), FastMath.toRadians(319.779), PositionAngle.MEAN, FramesFactory.getEME2000(), iniDate, Constants.EIGEN5C_EARTH_MU);
KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC));
DateDetector dateDetector = new DateDetector(iniDate.shiftedBy(-300));
Vector3D deltaV = new Vector3D(12.0, 1.0, -4.0);
final double isp = 300;
ImpulseManeuver<DateDetector> maneuver = new ImpulseManeuver<DateDetector>(dateDetector, deltaV, isp).withMaxCheck(3600.0).withThreshold(1.0e-6);
propagator.addEventDetector(maneuver);
SpacecraftState finalState = propagator.propagate(initialOrbit.getDate().shiftedBy(-900));
Assert.assertTrue(finalState.getMass() > propagator.getInitialState().getMass());
Assert.assertTrue(finalState.getDate().compareTo(propagator.getInitialState().getDate()) < 0);
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class TopocentricFrameTest method testDoppler.
@Test
public void testDoppler() throws OrekitException {
// Surface point at latitude 45, longitude 5
final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(45.), FastMath.toRadians(5.), 0.);
final TopocentricFrame topoFrame = new TopocentricFrame(earthSpheric, point, "lon 5 lat 45");
// Point at 30 deg longitude
// ***************************
final CircularOrbit orbit = new CircularOrbit(7178000.0, 0.5e-8, -0.5e-8, FastMath.toRadians(50.), FastMath.toRadians(120.), FastMath.toRadians(90.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
// Transform satellite position to position/velocity parameters in body frame
final Transform eme2000ToItrf = FramesFactory.getEME2000().getTransformTo(earthSpheric.getBodyFrame(), date);
final PVCoordinates pvSatItrf = eme2000ToItrf.transformPVCoordinates(orbit.getPVCoordinates());
// Compute range rate directly
// ********************************************
final double dop = topoFrame.getRangeRate(pvSatItrf, earthSpheric.getBodyFrame(), date);
// Compare to finite difference computation (2 points)
// *****************************************************
final double dt = 0.1;
KeplerianPropagator extrapolator = new KeplerianPropagator(orbit);
// Extrapolate satellite position a short while after reference date
AbsoluteDate dateP = date.shiftedBy(dt);
Transform j2000ToItrfP = FramesFactory.getEME2000().getTransformTo(earthSpheric.getBodyFrame(), dateP);
SpacecraftState orbitP = extrapolator.propagate(dateP);
Vector3D satPointGeoP = j2000ToItrfP.transformPVCoordinates(orbitP.getPVCoordinates()).getPosition();
// Retropolate satellite position a short while before reference date
AbsoluteDate dateM = date.shiftedBy(-dt);
Transform j2000ToItrfM = FramesFactory.getEME2000().getTransformTo(earthSpheric.getBodyFrame(), dateM);
SpacecraftState orbitM = extrapolator.propagate(dateM);
Vector3D satPointGeoM = j2000ToItrfM.transformPVCoordinates(orbitM.getPVCoordinates()).getPosition();
// Compute ranges at both instants
double rangeP = topoFrame.getRange(satPointGeoP, earthSpheric.getBodyFrame(), dateP);
double rangeM = topoFrame.getRange(satPointGeoM, earthSpheric.getBodyFrame(), dateM);
final double dopRef2 = (rangeP - rangeM) / (2. * dt);
Assert.assertEquals(dopRef2, dop, 1.e-3);
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class FiniteDifferencePropagatorConverterTest method testGetObjectiveFunctionParametersOnlyScaledOnce.
/**
* Test case for bug #362. Check that scaling is only applied once.
*
* @throws OrekitException on error.
*/
@Test
public void testGetObjectiveFunctionParametersOnlyScaledOnce() throws OrekitException {
// setup
// create some arbitrary sample data to run with
Frame eci = FramesFactory.getGCRF();
double gm = Constants.EIGEN5C_EARTH_MU;
AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
Propagator source = new KeplerianPropagator(new KeplerianOrbit(6878137, 0, 0, 0, 0, 0, PositionAngle.TRUE, eci, date, gm));
// Create a mock builder that allows us to check the values passed to it
PropagatorBuilder builder = Mockito.mock(PropagatorBuilder.class);
ParameterDriversList list = new ParameterDriversList();
list.add(new ParameterDriver("p1", 0, 1e-3, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
Mockito.when(builder.getOrbitalParametersDrivers()).thenReturn(list);
Mockito.when(builder.getPropagationParametersDrivers()).thenReturn(new ParameterDriversList());
Mockito.when(builder.getFrame()).thenReturn(eci);
Mockito.when(builder.getSelectedNormalizedParameters()).thenReturn(new double[1]);
Mockito.when(builder.buildPropagator(Mockito.any(double[].class))).thenReturn(source);
// subject under test
FiniteDifferencePropagatorConverter converter = new FiniteDifferencePropagatorConverter(builder, 1, 100);
// set some internal variables in FDPC that are not settable using another
// interface
converter.convert(source, 1, 2);
// Forget all the side effect of the call to convert()
Mockito.clearInvocations(builder);
// action
converter.getModel().value(new ArrayRealVector(1));
// verify
Mockito.verify(builder).buildPropagator(new double[] { 0 });
Mockito.verify(builder).buildPropagator(new double[] { 1 });
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class KeplerianConverterTest method checkFit.
protected void checkFit(final Orbit orbit, final double duration, final double stepSize, final double threshold, final boolean positionOnly, final double expectedRMS, final String... freeParameters) throws OrekitException {
Propagator p = new KeplerianPropagator(orbit);
List<SpacecraftState> sample = new ArrayList<SpacecraftState>();
for (double dt = 0; dt < duration; dt += stepSize) {
sample.add(p.propagate(orbit.getDate().shiftedBy(dt)));
}
PropagatorBuilder builder = new KeplerianPropagatorBuilder(OrbitType.KEPLERIAN.convertType(orbit), PositionAngle.MEAN, 1.0);
FiniteDifferencePropagatorConverter fitter = new FiniteDifferencePropagatorConverter(builder, threshold, 1000);
fitter.convert(sample, positionOnly, freeParameters);
Assert.assertEquals(expectedRMS, fitter.getRMS(), 0.01 * expectedRMS);
KeplerianPropagator prop = (KeplerianPropagator) fitter.getAdaptedPropagator();
Orbit fitted = prop.getInitialState().getOrbit();
final double eps = 1.0e-12;
Assert.assertEquals(orbit.getPVCoordinates().getPosition().getX(), fitted.getPVCoordinates().getPosition().getX(), eps * orbit.getPVCoordinates().getPosition().getX());
Assert.assertEquals(orbit.getPVCoordinates().getPosition().getY(), fitted.getPVCoordinates().getPosition().getY(), eps * orbit.getPVCoordinates().getPosition().getY());
Assert.assertEquals(orbit.getPVCoordinates().getPosition().getZ(), fitted.getPVCoordinates().getPosition().getZ(), eps * orbit.getPVCoordinates().getPosition().getZ());
Assert.assertEquals(orbit.getPVCoordinates().getVelocity().getX(), fitted.getPVCoordinates().getVelocity().getX(), -eps * orbit.getPVCoordinates().getVelocity().getX());
Assert.assertEquals(orbit.getPVCoordinates().getVelocity().getY(), fitted.getPVCoordinates().getVelocity().getY(), eps * orbit.getPVCoordinates().getVelocity().getY());
Assert.assertEquals(orbit.getPVCoordinates().getVelocity().getZ(), fitted.getPVCoordinates().getVelocity().getZ(), eps * orbit.getPVCoordinates().getVelocity().getZ());
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class ElevationDetectorTest method testIssue110.
@Test
public void testIssue110() throws OrekitException {
// KEPLERIAN PROPAGATOR
final Frame eme2000Frame = FramesFactory.getEME2000();
final AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH;
final double a = 7000000.0;
final Orbit initialOrbit = new KeplerianOrbit(a, 0.0, FastMath.PI / 2.2, 0.0, FastMath.PI / 2., 0.0, PositionAngle.TRUE, eme2000Frame, initDate, Constants.EGM96_EARTH_MU);
final KeplerianPropagator kProp = new KeplerianPropagator(initialOrbit);
// earth shape
final OneAxisEllipsoid earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
// Ground station
final GeodeticPoint stat = new GeodeticPoint(FastMath.toRadians(35.), FastMath.toRadians(149.8), 0.);
final TopocentricFrame station = new TopocentricFrame(earthShape, stat, "GSTATION");
// detector creation
// =================
final double maxCheck = 600.;
final double threshold = 1.0e-3;
final EventDetector rawEvent = new ElevationDetector(maxCheck, threshold, station).withConstantElevation(FastMath.toRadians(5.0)).withHandler(new ContinueOnEvent<ElevationDetector>());
final EventsLogger logger = new EventsLogger();
kProp.addEventDetector(logger.monitorDetector(rawEvent));
// PROPAGATION with DETECTION
final AbsoluteDate finalDate = initDate.shiftedBy(30 * 60.);
kProp.propagate(finalDate);
Assert.assertEquals(2, logger.getLoggedEvents().size());
Assert.assertTrue(logger.getLoggedEvents().get(0).isIncreasing());
Assert.assertEquals(478.945, logger.getLoggedEvents().get(0).getState().getDate().durationFrom(initDate), 1.0e-3);
Assert.assertFalse(logger.getLoggedEvents().get(1).isIncreasing());
Assert.assertEquals(665.721, logger.getLoggedEvents().get(1).getState().getDate().durationFrom(initDate), 1.0e-3);
}
Aggregations