use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class DSSTPropagatorTest method testIssue364.
@Test
public void testIssue364() throws OrekitException {
Utils.setDataRoot("regular-data");
AbsoluteDate date = new AbsoluteDate("2003-06-18T00:00:00.000", TimeScalesFactory.getUTC());
CircularOrbit orbit = new CircularOrbit(7389068.5, 0.0, 0.0, 1.709573, 1.308398, 0, PositionAngle.MEAN, FramesFactory.getTOD(IERSConventions.IERS_2010, false), date, Constants.WGS84_EARTH_MU);
SpacecraftState osculatingState = new SpacecraftState(orbit, 1116.2829);
List<DSSTForceModel> dsstForceModels = new ArrayList<DSSTForceModel>();
dsstForceModels.add(new DSSTThirdBody(CelestialBodyFactory.getMoon()));
dsstForceModels.add(new DSSTThirdBody(CelestialBodyFactory.getSun()));
SpacecraftState meanState = DSSTPropagator.computeMeanState(osculatingState, null, dsstForceModels);
Assert.assertEquals(0.421, osculatingState.getA() - meanState.getA(), 1.0e-3);
Assert.assertEquals(-5.23e-8, osculatingState.getEquinoctialEx() - meanState.getEquinoctialEx(), 1.0e-10);
Assert.assertEquals(15.22e-8, osculatingState.getEquinoctialEy() - meanState.getEquinoctialEy(), 1.0e-10);
Assert.assertEquals(-3.15e-8, osculatingState.getHx() - meanState.getHx(), 1.0e-10);
Assert.assertEquals(2.83e-8, osculatingState.getHy() - meanState.getHy(), 1.0e-10);
Assert.assertEquals(15.96e-8, osculatingState.getLM() - meanState.getLM(), 1.0e-10);
}
use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class DSSTPropagatorTest method testEphemerisDates.
@Test
public void testEphemerisDates() throws OrekitException {
// setup
TimeScale tai = TimeScalesFactory.getTAI();
AbsoluteDate initialDate = new AbsoluteDate("2015-07-01", tai);
AbsoluteDate startDate = new AbsoluteDate("2015-07-03", tai).shiftedBy(-0.1);
AbsoluteDate endDate = new AbsoluteDate("2015-07-04", tai);
Frame eci = FramesFactory.getGCRF();
KeplerianOrbit orbit = new KeplerianOrbit(600e3 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS, 0, 0, 0, 0, 0, PositionAngle.TRUE, eci, initialDate, Constants.EIGEN5C_EARTH_MU);
double[][] tol = DSSTPropagator.tolerances(1, orbit);
Propagator prop = new DSSTPropagator(new DormandPrince853Integrator(0.1, 500, tol[0], tol[1]));
prop.resetInitialState(new SpacecraftState(new CartesianOrbit(orbit)));
// action
prop.setEphemerisMode();
prop.propagate(startDate, endDate);
BoundedPropagator ephemeris = prop.getGeneratedEphemeris();
// verify
TimeStampedPVCoordinates actualPV = ephemeris.getPVCoordinates(startDate, eci);
TimeStampedPVCoordinates expectedPV = orbit.getPVCoordinates(startDate, eci);
MatcherAssert.assertThat(actualPV.getPosition(), OrekitMatchers.vectorCloseTo(expectedPV.getPosition(), 1.0));
MatcherAssert.assertThat(actualPV.getVelocity(), OrekitMatchers.vectorCloseTo(expectedPV.getVelocity(), 1.0));
MatcherAssert.assertThat(ephemeris.getMinDate().durationFrom(startDate), OrekitMatchers.closeTo(0, 0));
MatcherAssert.assertThat(ephemeris.getMaxDate().durationFrom(endDate), OrekitMatchers.closeTo(0, 0));
// test date
AbsoluteDate date = endDate.shiftedBy(-0.11);
Assert.assertEquals(ephemeris.propagate(date).getDate().durationFrom(date), 0, 0);
}
use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class DSSTPropagatorTest method testIssue339WithAccelerations.
@Test
public void testIssue339WithAccelerations() throws OrekitException {
final SpacecraftState osculatingState = getLEOStatePropagatedBy30Minutes();
final CelestialBody sun = CelestialBodyFactory.getSun();
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
final BoxAndSolarArraySpacecraft boxAndWing = new BoxAndSolarArraySpacecraft(5.0, 2.0, 2.0, sun, 50.0, Vector3D.PLUS_J, 2.0, 0.1, 0.2, 0.6);
final Atmosphere atmosphere = new HarrisPriester(CelestialBodyFactory.getSun(), earth, 6);
final AttitudeProvider attitudeProvider = new LofOffset(osculatingState.getFrame(), LOFType.VVLH, RotationOrder.XYZ, 0.0, 0.0, 0.0);
// Surface force models that require an attitude provider
final Collection<DSSTForceModel> forces = new ArrayList<DSSTForceModel>();
forces.add(new DSSTAtmosphericDrag(atmosphere, boxAndWing));
final SpacecraftState meanState = DSSTPropagator.computeMeanState(osculatingState, attitudeProvider, forces);
final SpacecraftState computedOsculatingState = DSSTPropagator.computeOsculatingState(meanState, attitudeProvider, forces);
Assert.assertEquals(0.0, Vector3D.distance(osculatingState.getPVCoordinates().getPosition(), computedOsculatingState.getPVCoordinates().getPosition()), 5.0e-6);
}
use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class DSSTPropagatorTest method testEphemeris.
@Test
public void testEphemeris() throws OrekitException {
SpacecraftState state = getGEOState();
setDSSTProp(state);
// Set ephemeris mode
dsstProp.setEphemerisMode();
// Propagation of the initial state at t + 10 days
final double dt = 2. * Constants.JULIAN_DAY;
dsstProp.propagate(state.getDate().shiftedBy(5. * dt));
// Get ephemeris
BoundedPropagator ephem = dsstProp.getGeneratedEphemeris();
// Propagation of the initial state with ephemeris at t + 2 days
final SpacecraftState s = ephem.propagate(state.getDate().shiftedBy(dt));
// Check results
final double n = FastMath.sqrt(state.getMu() / state.getA()) / state.getA();
Assert.assertEquals(state.getA(), s.getA(), 0.);
Assert.assertEquals(state.getEquinoctialEx(), s.getEquinoctialEx(), 0.);
Assert.assertEquals(state.getEquinoctialEy(), s.getEquinoctialEy(), 0.);
Assert.assertEquals(state.getHx(), s.getHx(), 0.);
Assert.assertEquals(state.getHy(), s.getHy(), 0.);
Assert.assertEquals(state.getLM() + n * dt, s.getLM(), 1.5e-14);
}
use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class DSSTPropagatorTest method testStopEvent.
@Test
public void testStopEvent() throws OrekitException {
SpacecraftState state = getLEOState();
setDSSTProp(state);
final AbsoluteDate stopDate = state.getDate().shiftedBy(1000);
CheckingHandler<DateDetector> checking = new CheckingHandler<DateDetector>(Action.STOP);
dsstProp.addEventDetector(new DateDetector(stopDate).withHandler(checking));
checking.assertEvent(false);
final SpacecraftState finalState = dsstProp.propagate(state.getDate().shiftedBy(3200));
checking.assertEvent(true);
Assert.assertEquals(0, finalState.getDate().durationFrom(stopDate), 1.0e-10);
}
Aggregations