Search in sources :

Example 31 with SpacecraftState

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

the class HolmesFeatherstoneAttractionModelTest method testTimeDependentField.

@Test
public void testTimeDependentField() throws OrekitException {
    Utils.setDataRoot("regular-data:potential/icgem-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("eigen-6s-truncated", true));
    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06, -1.32931592294715829e+04);
    final Vector3D vel = new Vector3D(2.14718074509906819e+03, 7.38239351251748485e+03, -1.14097953925384523e+01);
    final SpacecraftState spacecraftState = new SpacecraftState(new CartesianOrbit(new PVCoordinates(pos, vel), FramesFactory.getGCRF(), new AbsoluteDate(2005, 3, 5, 0, 24, 0.0, TimeScalesFactory.getTAI()), GravityFieldFactory.getUnnormalizedProvider(1, 1).getMu()));
    double dP = 0.1;
    double duration = 3 * Constants.JULIAN_DAY;
    BoundedPropagator fixedFieldEphemeris = createEphemeris(dP, spacecraftState, duration, GravityFieldFactory.getConstantNormalizedProvider(8, 8));
    BoundedPropagator varyingFieldEphemeris = createEphemeris(dP, spacecraftState, duration, GravityFieldFactory.getNormalizedProvider(8, 8));
    double step = 60.0;
    double maxDeltaT = 0;
    double maxDeltaN = 0;
    double maxDeltaW = 0;
    for (AbsoluteDate date = fixedFieldEphemeris.getMinDate(); date.compareTo(fixedFieldEphemeris.getMaxDate()) < 0; date = date.shiftedBy(step)) {
        PVCoordinates pvFixedField = fixedFieldEphemeris.getPVCoordinates(date, FramesFactory.getGCRF());
        PVCoordinates pvVaryingField = varyingFieldEphemeris.getPVCoordinates(date, FramesFactory.getGCRF());
        Vector3D t = pvFixedField.getVelocity().normalize();
        Vector3D w = pvFixedField.getMomentum().normalize();
        Vector3D n = Vector3D.crossProduct(w, t);
        Vector3D delta = pvVaryingField.getPosition().subtract(pvFixedField.getPosition());
        maxDeltaT = FastMath.max(maxDeltaT, FastMath.abs(Vector3D.dotProduct(delta, t)));
        maxDeltaN = FastMath.max(maxDeltaN, FastMath.abs(Vector3D.dotProduct(delta, n)));
        maxDeltaW = FastMath.max(maxDeltaW, FastMath.abs(Vector3D.dotProduct(delta, w)));
    }
    Assert.assertTrue(maxDeltaT > 0.15);
    Assert.assertTrue(maxDeltaT < 0.25);
    Assert.assertTrue(maxDeltaN > 0.01);
    Assert.assertTrue(maxDeltaN < 0.02);
    Assert.assertTrue(maxDeltaW > 0.05);
    Assert.assertTrue(maxDeltaW < 0.10);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) ICGEMFormatReader(org.orekit.forces.gravity.potential.ICGEMFormatReader) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) BoundedPropagator(org.orekit.propagation.BoundedPropagator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 32 with SpacecraftState

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

the class HolmesFeatherstoneAttractionModelTest method testParameterDerivative.

@Test
public void testParameterDerivative() throws OrekitException {
    Utils.setDataRoot("regular-data:potential/grgs-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim4s4_gr", true));
    // pos-vel (from a ZOOM ephemeris reference)
    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06, -1.32931592294715829e+04);
    final Vector3D vel = new Vector3D(2.14718074509906819e+03, 7.38239351251748485e+03, -1.14097953925384523e+01);
    final SpacecraftState state = new SpacecraftState(new CartesianOrbit(new PVCoordinates(pos, vel), FramesFactory.getGCRF(), new AbsoluteDate(2005, 3, 5, 0, 24, 0.0, TimeScalesFactory.getTAI()), GravityFieldFactory.getUnnormalizedProvider(1, 1).getMu()));
    final HolmesFeatherstoneAttractionModel holmesFeatherstoneModel = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(20, 20));
    final String name = NewtonianAttraction.CENTRAL_ATTRACTION_COEFFICIENT;
    checkParameterDerivative(state, holmesFeatherstoneModel, name, 1.0e-5, 5.0e-12);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) GRGSFormatReader(org.orekit.forces.gravity.potential.GRGSFormatReader) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 33 with SpacecraftState

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

the class HolmesFeatherstoneAttractionModelTest method testCompleteWithCunninghamReference.

@Test
@Deprecated
public void testCompleteWithCunninghamReference() throws OrekitException {
    Utils.setDataRoot("regular-data:potential/grgs-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim4s4_gr", true));
    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2000, 07, 01), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
    double i = FastMath.toRadians(98.7);
    double omega = FastMath.toRadians(93.0);
    double OMEGA = FastMath.toRadians(15.0 * 22.5);
    Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, i, omega, OMEGA, 0, PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    double[][] tolerances = NumericalPropagator.tolerances(0.01, orbit, OrbitType.CARTESIAN);
    AbsoluteDate targetDate = date.shiftedBy(3 * Constants.JULIAN_DAY);
    propagator = new NumericalPropagator(new DormandPrince853Integrator(1.0e-3, 120, tolerances[0], tolerances[1]));
    propagator.setOrbitType(OrbitType.CARTESIAN);
    propagator.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(69, 69)));
    propagator.setInitialState(new SpacecraftState(orbit));
    SpacecraftState hfOrb = propagator.propagate(targetDate);
    propagator.removeForceModels();
    propagator.addForceModel(new CunninghamAttractionModel(itrf, GravityFieldFactory.getUnnormalizedProvider(69, 69)));
    propagator.setInitialState(new SpacecraftState(orbit));
    SpacecraftState cOrb = propagator.propagate(targetDate);
    Vector3D dif = hfOrb.getPVCoordinates().getPosition().subtract(cOrb.getPVCoordinates().getPosition());
    Assert.assertEquals(0, dif.getNorm(), 4e-5);
}
Also used : 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) GRGSFormatReader(org.orekit.forces.gravity.potential.GRGSFormatReader) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 34 with SpacecraftState

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

the class OceanTidesTest method testDefaultInterpolation.

@Test
public void testDefaultInterpolation() throws OrekitException {
    IERSConventions conventions = IERSConventions.IERS_2010;
    Frame eme2000 = FramesFactory.getEME2000();
    Frame itrf = FramesFactory.getITRF(conventions, true);
    TimeScale utc = TimeScalesFactory.getUTC();
    UT1Scale ut1 = TimeScalesFactory.getUT1(conventions, true);
    AstronomicalAmplitudeReader aaReader = new AstronomicalAmplitudeReader("hf-fes2004.dat", 5, 2, 3, 1.0);
    DataProvidersManager.getInstance().feed(aaReader.getSupportedNames(), aaReader);
    Map<Integer, Double> map = aaReader.getAstronomicalAmplitudesMap();
    GravityFieldFactory.addOceanTidesReader(new FESCHatEpsilonReader("fes2004-7x7.dat", 0.01, FastMath.toRadians(1.0), OceanLoadDeformationCoefficients.IERS_2010, map));
    NormalizedSphericalHarmonicsProvider gravityField = GravityFieldFactory.getConstantNormalizedProvider(5, 5);
    // initialization
    AbsoluteDate date = new AbsoluteDate(1970, 07, 01, 13, 59, 27.816, utc);
    Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, FastMath.toRadians(98.7), FastMath.toRadians(93.0), FastMath.toRadians(15.0 * 22.5), 0, PositionAngle.MEAN, eme2000, date, gravityField.getMu());
    AbsoluteDate target = date.shiftedBy(7 * Constants.JULIAN_DAY);
    ForceModel hf = new HolmesFeatherstoneAttractionModel(itrf, gravityField);
    SpacecraftState raw = propagate(orbit, target, hf, new OceanTides(itrf, gravityField.getAe(), gravityField.getMu(), true, Double.NaN, -1, 6, 6, conventions, ut1));
    SpacecraftState interpolated = propagate(orbit, target, hf, new OceanTides(itrf, gravityField.getAe(), gravityField.getMu(), 6, 6, IERSConventions.IERS_2010, ut1));
    Assert.assertEquals(0.0, Vector3D.distance(raw.getPVCoordinates().getPosition(), interpolated.getPVCoordinates().getPosition()), // threshold would be 3.4e-5 for 30 days propagation
    9.9e-6);
}
Also used : Frame(org.orekit.frames.Frame) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) ForceModel(org.orekit.forces.ForceModel) IERSConventions(org.orekit.utils.IERSConventions) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) UT1Scale(org.orekit.time.UT1Scale) FESCHatEpsilonReader(org.orekit.forces.gravity.potential.FESCHatEpsilonReader) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) AstronomicalAmplitudeReader(org.orekit.forces.gravity.potential.AstronomicalAmplitudeReader) Test(org.junit.Test)

Example 35 with SpacecraftState

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

the class OceanTidesTest method propagate.

private SpacecraftState propagate(Orbit orbit, AbsoluteDate target, ForceModel... forceModels) throws OrekitException {
    double[][] tolerances = NumericalPropagator.tolerances(10, orbit, OrbitType.KEPLERIAN);
    AbstractIntegrator integrator = new DormandPrince853Integrator(1.0e-3, 300, tolerances[0], tolerances[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    for (ForceModel forceModel : forceModels) {
        propagator.addForceModel(forceModel);
    }
    propagator.setInitialState(new SpacecraftState(orbit));
    return propagator.propagate(target);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ForceModel(org.orekit.forces.ForceModel) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator)

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