Search in sources :

Example 81 with SpacecraftState

use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.

the class DSSTPropagatorTest method testIssue363.

@Test
public void testIssue363() throws OrekitException {
    Utils.setDataRoot("regular-data");
    AbsoluteDate date = new AbsoluteDate("2003-06-18T00:00:00.000", TimeScalesFactory.getUTC());
    CircularOrbit orbit = new CircularOrbit(7389068.5, 1.0e-15, 1.0e-15, 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);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) DSSTThirdBody(org.orekit.propagation.semianalytical.dsst.forces.DSSTThirdBody) CircularOrbit(org.orekit.orbits.CircularOrbit) ArrayList(java.util.ArrayList) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 82 with SpacecraftState

use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.

the class DSSTPropagatorTest method testIssueMeanInclination.

@Test
public void testIssueMeanInclination() throws OrekitException {
    final double earthAe = 6378137.0;
    final double earthMu = 3.9860044E14;
    final double earthJ2 = 0.0010826;
    // Initialize the DSST propagator with only J2 perturbation
    Orbit orb = new KeplerianOrbit(new TimeStampedPVCoordinates(new AbsoluteDate("1992-10-08T15:20:38.821", TimeScalesFactory.getUTC()), new Vector3D(5392808.809823, -4187618.3357927715, -44206.638015847195), new Vector3D(2337.4472786270794, 2474.0146611860464, 6778.507766114648)), FramesFactory.getTOD(false), earthMu);
    final SpacecraftState ss = new SpacecraftState(orb);
    final UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(earthAe, earthMu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { -earthJ2 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 } });
    final Frame earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
    DSSTForceModel zonal = new DSSTZonal(provider, 2, 1, 5);
    DSSTForceModel tesseral = new DSSTTesseral(earthFrame, Constants.WGS84_EARTH_ANGULAR_VELOCITY, provider, 2, 0, 0, 2, 2, 0, 0);
    final Collection<DSSTForceModel> forces = new ArrayList<DSSTForceModel>();
    forces.add(zonal);
    forces.add(tesseral);
    // Computes J2 mean elements using the DSST osculating to mean converter
    final Orbit meanOrb = DSSTPropagator.computeMeanState(ss, null, forces).getOrbit();
    Assert.assertEquals(0.0164196, FastMath.toDegrees(orb.getI() - meanOrb.getI()), 1.0e-7);
}
Also used : Frame(org.orekit.frames.Frame) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) DSSTZonal(org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal) ArrayList(java.util.ArrayList) DSSTTesseral(org.orekit.propagation.semianalytical.dsst.forces.DSSTTesseral) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) UnnormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test)

Example 83 with SpacecraftState

use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.

the class DSSTPropagatorTest method testNoExtrapolation.

@Test
public void testNoExtrapolation() throws OrekitException {
    SpacecraftState state = getLEOState();
    setDSSTProp(state);
    // Propagation of the initial state at the initial date
    final SpacecraftState finalState = dsstProp.propagate(state.getDate());
    // Initial orbit definition
    final Vector3D initialPosition = state.getPVCoordinates().getPosition();
    final Vector3D initialVelocity = state.getPVCoordinates().getVelocity();
    // Final orbit definition
    final Vector3D finalPosition = finalState.getPVCoordinates().getPosition();
    final Vector3D finalVelocity = finalState.getPVCoordinates().getVelocity();
    // Check results
    Assert.assertEquals(initialPosition.getX(), finalPosition.getX(), 0.0);
    Assert.assertEquals(initialPosition.getY(), finalPosition.getY(), 0.0);
    Assert.assertEquals(initialPosition.getZ(), finalPosition.getZ(), 0.0);
    Assert.assertEquals(initialVelocity.getX(), finalVelocity.getX(), 0.0);
    Assert.assertEquals(initialVelocity.getY(), finalVelocity.getY(), 0.0);
    Assert.assertEquals(initialVelocity.getZ(), finalVelocity.getZ(), 0.0);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Test(org.junit.Test)

Example 84 with SpacecraftState

use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.

the class DSSTPropagatorTest method testEphemerisGeneration.

@Test
public void testEphemerisGeneration() throws OrekitException {
    Utils.setDataRoot("regular-data:potential/icgem-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("^eigen-6s-truncated$", false));
    UnnormalizedSphericalHarmonicsProvider nshp = GravityFieldFactory.getUnnormalizedProvider(8, 8);
    Orbit orbit = new KeplerianOrbit(13378000, 0.05, 0, 0, FastMath.PI, 0, PositionAngle.MEAN, FramesFactory.getTOD(false), new AbsoluteDate(2003, 5, 6, TimeScalesFactory.getUTC()), nshp.getMu());
    double period = orbit.getKeplerianPeriod();
    double[][] tolerance = DSSTPropagator.tolerances(1.0, orbit);
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(period / 100, period * 100, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(10 * period);
    DSSTPropagator propagator = new DSSTPropagator(integrator, false);
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getGTOD(false));
    CelestialBody sun = CelestialBodyFactory.getSun();
    CelestialBody moon = CelestialBodyFactory.getMoon();
    propagator.addForceModel(new DSSTZonal(nshp, 8, 7, 17));
    propagator.addForceModel(new DSSTTesseral(earth.getBodyFrame(), Constants.WGS84_EARTH_ANGULAR_VELOCITY, nshp, 8, 8, 4, 12, 8, 8, 4));
    propagator.addForceModel(new DSSTThirdBody(sun));
    propagator.addForceModel(new DSSTThirdBody(moon));
    propagator.addForceModel(new DSSTAtmosphericDrag(new HarrisPriester(sun, earth), 2.1, 180));
    propagator.addForceModel(new DSSTSolarRadiationPressure(1.2, 180, sun, earth.getEquatorialRadius()));
    propagator.setInterpolationGridToMaxTimeGap(0.5 * Constants.JULIAN_DAY);
    // direct generation of states
    propagator.setInitialState(new SpacecraftState(orbit, 45.0), false);
    final List<SpacecraftState> states = new ArrayList<SpacecraftState>();
    propagator.setMasterMode(600, (currentState, isLast) -> states.add(currentState));
    propagator.propagate(orbit.getDate().shiftedBy(30 * Constants.JULIAN_DAY));
    // ephemeris generation
    propagator.setInitialState(new SpacecraftState(orbit, 45.0), false);
    propagator.setEphemerisMode();
    propagator.propagate(orbit.getDate().shiftedBy(30 * Constants.JULIAN_DAY));
    BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
    double maxError = 0;
    for (final SpacecraftState state : states) {
        final SpacecraftState fromEphemeris = ephemeris.propagate(state.getDate());
        final double error = Vector3D.distance(state.getPVCoordinates().getPosition(), fromEphemeris.getPVCoordinates().getPosition());
        maxError = FastMath.max(maxError, error);
    }
    Assert.assertEquals(0.0, maxError, 1.0e-10);
}
Also used : HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) ICGEMFormatReader(org.orekit.forces.gravity.potential.ICGEMFormatReader) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DSSTZonal(org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal) ArrayList(java.util.ArrayList) DSSTTesseral(org.orekit.propagation.semianalytical.dsst.forces.DSSTTesseral) DSSTAtmosphericDrag(org.orekit.propagation.semianalytical.dsst.forces.DSSTAtmosphericDrag) AbsoluteDate(org.orekit.time.AbsoluteDate) DSSTSolarRadiationPressure(org.orekit.propagation.semianalytical.dsst.forces.DSSTSolarRadiationPressure) SpacecraftState(org.orekit.propagation.SpacecraftState) DSSTThirdBody(org.orekit.propagation.semianalytical.dsst.forces.DSSTThirdBody) UnnormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider) CelestialBody(org.orekit.bodies.CelestialBody) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Test(org.junit.Test)

Example 85 with SpacecraftState

use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.

the class DSSTPropagatorTest method testContinueEvent.

@Test
public void testContinueEvent() throws OrekitException {
    SpacecraftState state = getLEOState();
    setDSSTProp(state);
    final AbsoluteDate resetDate = state.getDate().shiftedBy(1000);
    CheckingHandler<DateDetector> checking = new CheckingHandler<DateDetector>(Action.CONTINUE);
    dsstProp.addEventDetector(new DateDetector(resetDate).withHandler(checking));
    final double dt = 3200;
    checking.assertEvent(false);
    final SpacecraftState finalState = dsstProp.propagate(state.getDate().shiftedBy(dt));
    checking.assertEvent(true);
    final double n = FastMath.sqrt(state.getMu() / state.getA()) / state.getA();
    Assert.assertEquals(state.getA(), finalState.getA(), 1.0e-10);
    Assert.assertEquals(state.getEquinoctialEx(), finalState.getEquinoctialEx(), 1.0e-10);
    Assert.assertEquals(state.getEquinoctialEy(), finalState.getEquinoctialEy(), 1.0e-10);
    Assert.assertEquals(state.getHx(), finalState.getHx(), 1.0e-10);
    Assert.assertEquals(state.getHy(), finalState.getHy(), 1.0e-10);
    Assert.assertEquals(state.getLM() + n * dt, finalState.getLM(), 6.0e-10);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) SpacecraftState(org.orekit.propagation.SpacecraftState) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

SpacecraftState (org.orekit.propagation.SpacecraftState)470 Test (org.junit.Test)324 AbsoluteDate (org.orekit.time.AbsoluteDate)280 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)178 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)153 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)138 Orbit (org.orekit.orbits.Orbit)131 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)127 PVCoordinates (org.orekit.utils.PVCoordinates)98 CartesianOrbit (org.orekit.orbits.CartesianOrbit)95 Propagator (org.orekit.propagation.Propagator)92 Frame (org.orekit.frames.Frame)79 OrekitException (org.orekit.errors.OrekitException)74 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)74 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)74 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)70 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)64 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)61 CircularOrbit (org.orekit.orbits.CircularOrbit)58 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)57