Search in sources :

Example 31 with EquinoctialOrbit

use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.

the class DSSTPropagator method computeMeanOrbit.

/**
 * Compute mean state from osculating state.
 * <p>
 * Compute in a DSST sense the mean state corresponding to the input osculating state.
 * </p><p>
 * The computing is done through a fixed-point iteration process.
 * </p>
 * @param osculating initial osculating state
 * @param attitudeProvider attitude provider (may be null if there are no Gaussian force models
 * like atmospheric drag, radiation pressure or specific user-defined models)
 * @param forceModels force models
 * @return mean state
 * @throws OrekitException if the underlying computation of short periodic variation fails
 */
private static Orbit computeMeanOrbit(final SpacecraftState osculating, final AttitudeProvider attitudeProvider, final Collection<DSSTForceModel> forceModels) throws OrekitException {
    // rough initialization of the mean parameters
    EquinoctialOrbit meanOrbit = (EquinoctialOrbit) OrbitType.EQUINOCTIAL.convertType(osculating.getOrbit());
    // threshold for each parameter
    final double epsilon = 1.0e-13;
    final double thresholdA = epsilon * (1 + FastMath.abs(meanOrbit.getA()));
    final double thresholdE = epsilon * (1 + meanOrbit.getE());
    final double thresholdI = epsilon * (1 + meanOrbit.getI());
    final double thresholdL = epsilon * FastMath.PI;
    // ensure all Gaussian force models can rely on attitude
    for (final DSSTForceModel force : forceModels) {
        force.registerAttitudeProvider(attitudeProvider);
    }
    int i = 0;
    while (i++ < 200) {
        final SpacecraftState meanState = new SpacecraftState(meanOrbit, osculating.getAttitude(), osculating.getMass());
        // Create the auxiliary object
        final AuxiliaryElements aux = new AuxiliaryElements(meanOrbit, I);
        // Set the force models
        final List<ShortPeriodTerms> shortPeriodTerms = new ArrayList<ShortPeriodTerms>();
        for (final DSSTForceModel force : forceModels) {
            shortPeriodTerms.addAll(force.initialize(aux, false));
            force.updateShortPeriodTerms(meanState);
        }
        // recompute the osculating parameters from the current mean parameters
        final EquinoctialOrbit rebuilt = computeOsculatingOrbit(meanState, shortPeriodTerms);
        // adapted parameters residuals
        final double deltaA = osculating.getA() - rebuilt.getA();
        final double deltaEx = osculating.getEquinoctialEx() - rebuilt.getEquinoctialEx();
        final double deltaEy = osculating.getEquinoctialEy() - rebuilt.getEquinoctialEy();
        final double deltaHx = osculating.getHx() - rebuilt.getHx();
        final double deltaHy = osculating.getHy() - rebuilt.getHy();
        final double deltaLv = MathUtils.normalizeAngle(osculating.getLv() - rebuilt.getLv(), 0.0);
        // check convergence
        if (FastMath.abs(deltaA) < thresholdA && FastMath.abs(deltaEx) < thresholdE && FastMath.abs(deltaEy) < thresholdE && FastMath.abs(deltaHx) < thresholdI && FastMath.abs(deltaHy) < thresholdI && FastMath.abs(deltaLv) < thresholdL) {
            return meanOrbit;
        }
        // update mean parameters
        meanOrbit = new EquinoctialOrbit(meanOrbit.getA() + deltaA, meanOrbit.getEquinoctialEx() + deltaEx, meanOrbit.getEquinoctialEy() + deltaEy, meanOrbit.getHx() + deltaHx, meanOrbit.getHy() + deltaHy, meanOrbit.getLv() + deltaLv, PositionAngle.TRUE, meanOrbit.getFrame(), meanOrbit.getDate(), meanOrbit.getMu());
    }
    throw new OrekitException(OrekitMessages.UNABLE_TO_COMPUTE_DSST_MEAN_PARAMETERS, i);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ShortPeriodTerms(org.orekit.propagation.semianalytical.dsst.forces.ShortPeriodTerms) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) ArrayList(java.util.ArrayList) OrekitException(org.orekit.errors.OrekitException) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AuxiliaryElements(org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements)

Example 32 with EquinoctialOrbit

use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.

the class SolarRadiationPressureTest method testLighting.

@Test
public void testLighting() throws OrekitException, ParseException {
    // Initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 3, 21), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
    Orbit orbit = new EquinoctialOrbit(42164000, 10e-3, 10e-3, FastMath.tan(0.001745329) * FastMath.cos(2 * FastMath.PI / 3), FastMath.tan(0.001745329) * FastMath.sin(2 * FastMath.PI / 3), 0.1, PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.46, 1.0 / 298.25765, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    SolarRadiationPressure SRP = new SolarRadiationPressure(sun, earth.getEquatorialRadius(), (RadiationSensitive) new IsotropicRadiationCNES95Convention(50.0, 0.5, 0.5));
    double period = 2 * FastMath.PI * FastMath.sqrt(orbit.getA() * orbit.getA() * orbit.getA() / orbit.getMu());
    Assert.assertEquals(86164, period, 1);
    // creation of the propagator
    KeplerianPropagator k = new KeplerianPropagator(orbit);
    // intermediate variables
    AbsoluteDate currentDate;
    double changed = 1;
    int count = 0;
    for (int t = 1; t < 3 * period; t += 1000) {
        currentDate = date.shiftedBy(t);
        try {
            double ratio = SRP.getLightingRatio(k.propagate(currentDate).getPVCoordinates().getPosition(), FramesFactory.getEME2000(), currentDate);
            if (FastMath.floor(ratio) != changed) {
                changed = FastMath.floor(ratio);
                if (changed == 0) {
                    count++;
                }
            }
        } catch (OrekitException e) {
            e.printStackTrace();
        }
    }
    Assert.assertTrue(3 == count);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) OrekitException(org.orekit.errors.OrekitException) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 33 with EquinoctialOrbit

use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.

the class ThirdBodyAttractionTest method testMoonContrib.

@Test
public void testMoonContrib() throws OrekitException {
    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 07, 01), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
    Orbit orbit = new EquinoctialOrbit(42164000, 10e-3, 10e-3, FastMath.tan(0.001745329) * FastMath.cos(2 * FastMath.PI / 3), FastMath.tan(0.001745329) * FastMath.sin(2 * FastMath.PI / 3), 0.1, PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    double period = 2 * FastMath.PI * orbit.getA() * FastMath.sqrt(orbit.getA() / orbit.getMu());
    // set up propagator
    NumericalPropagator calc = new NumericalPropagator(new GraggBulirschStoerIntegrator(10.0, period, 0, 1.0e-5));
    calc.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getMoon()));
    // set up step handler to perform checks
    calc.setMasterMode(FastMath.floor(period), new ReferenceChecker(date) {

        protected double hXRef(double t) {
            return -0.000906173 + 1.93933e-11 * t + 1.0856e-06 * FastMath.cos(5.30637e-05 * t) - 1.22574e-06 * FastMath.sin(5.30637e-05 * t);
        }

        protected double hYRef(double t) {
            return 0.00151973 + 1.88991e-10 * t - 1.25972e-06 * FastMath.cos(5.30637e-05 * t) - 1.00581e-06 * FastMath.sin(5.30637e-05 * t);
        }
    });
    AbsoluteDate finalDate = date.shiftedBy(31 * period);
    calc.setInitialState(new SpacecraftState(orbit));
    calc.propagate(finalDate);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) GraggBulirschStoerIntegrator(org.hipparchus.ode.nonstiff.GraggBulirschStoerIntegrator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 34 with EquinoctialOrbit

use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.

the class DSSTPropagatorTest method getGEOState.

private SpacecraftState getGEOState() throws IllegalArgumentException, OrekitException {
    // No shadow at this date
    final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2003, 05, 21), new TimeComponents(1, 0, 0.), TimeScalesFactory.getUTC());
    final Orbit orbit = new EquinoctialOrbit(42164000, 10e-3, 10e-3, FastMath.tan(0.001745329) * FastMath.cos(2 * FastMath.PI / 3), FastMath.tan(0.001745329) * FastMath.sin(2 * FastMath.PI / 3), 0.1, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, 3.986004415E14);
    return new SpacecraftState(orbit);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) 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) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) AbsoluteDate(org.orekit.time.AbsoluteDate)

Example 35 with EquinoctialOrbit

use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.

the class ElevationDetectorTest method testPresTemp.

public void testPresTemp() throws OrekitException {
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, ae, mu, c20, c30, c40, c50, c60);
    // Earth and frame
    // equatorial radius in meter
    double ae = 6378137.0;
    // flattening
    double f = 1.0 / 298.257223563;
    // terrestrial frame at an arbitrary date
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(ae, f, itrf);
    GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(48.833), FastMath.toRadians(2.333), 0.0);
    TopocentricFrame topo = new TopocentricFrame(earth, point, "Gstation");
    EarthStandardAtmosphereRefraction refractionModel = new EarthStandardAtmosphereRefraction();
    ElevationDetector detector = new ElevationDetector(topo).withRefraction(refractionModel).withHandler(new StopOnIncreasing<ElevationDetector>());
    refractionModel.setPressure(101325);
    refractionModel.setTemperature(290);
    AbsoluteDate startDate = new AbsoluteDate(2003, 9, 15, 20, 0, 0, utc);
    propagator.resetInitialState(propagator.propagate(startDate));
    propagator.addEventDetector(detector);
    final SpacecraftState fs = propagator.propagate(startDate.shiftedBy(Constants.JULIAN_DAY));
    double elevation = topo.getElevation(fs.getPVCoordinates().getPosition(), fs.getFrame(), fs.getDate());
    Assert.assertEquals(FastMath.toRadians(1.7026104902251749), elevation, 2.0e-5);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) TimeScale(org.orekit.time.TimeScale) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) GeodeticPoint(org.orekit.bodies.GeodeticPoint) EarthStandardAtmosphereRefraction(org.orekit.models.earth.EarthStandardAtmosphereRefraction)

Aggregations

EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)58 AbsoluteDate (org.orekit.time.AbsoluteDate)49 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)48 PVCoordinates (org.orekit.utils.PVCoordinates)46 Orbit (org.orekit.orbits.Orbit)37 SpacecraftState (org.orekit.propagation.SpacecraftState)34 Test (org.junit.Test)29 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)25 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)20 Before (org.junit.Before)18 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)18 TimeScale (org.orekit.time.TimeScale)16 Frame (org.orekit.frames.Frame)15 CartesianOrbit (org.orekit.orbits.CartesianOrbit)15 CircularOrbit (org.orekit.orbits.CircularOrbit)15 EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)13 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)13 OrekitException (org.orekit.errors.OrekitException)12 Propagator (org.orekit.propagation.Propagator)11 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)10