Search in sources :

Example 1 with ForceModel

use of org.orekit.forces.ForceModel in project Orekit by CS-SI.

the class HolmesFeatherstoneAttractionModelTest method testIssue97.

@Test
@Deprecated
public void testIssue97() 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()));
    for (int i = 2; i <= 69; i++) {
        final ForceModel holmesFeatherstoneModel = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(i, i));
        final ForceModel cunninghamModel = new CunninghamAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getUnnormalizedProvider(i, i));
        double relativeError = accelerationRelativeError(holmesFeatherstoneModel, cunninghamModel, state);
        Assert.assertEquals(0.0, relativeError, 8.0e-15);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) ForceModel(org.orekit.forces.ForceModel) AbstractForceModel(org.orekit.forces.AbstractForceModel) 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 2 with ForceModel

use of org.orekit.forces.ForceModel 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 3 with ForceModel

use of org.orekit.forces.ForceModel in project Orekit by CS-SI.

the class OceanTidesTest method testNoSetParameter.

@Test
public void testNoSetParameter() throws OrekitException {
    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));
    ForceModel fm = new OceanTides(FramesFactory.getITRF(IERSConventions.IERS_1996, false), Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_MU, 5, 5, IERSConventions.IERS_1996, TimeScalesFactory.getUT1(IERSConventions.IERS_1996, false));
    Assert.assertEquals(1, fm.getParametersDrivers().length);
    try {
        fm.getParameterDriver("unknown").setValue(0.0);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException miae) {
        Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, miae.getSpecifier());
    }
}
Also used : FESCHatEpsilonReader(org.orekit.forces.gravity.potential.FESCHatEpsilonReader) ForceModel(org.orekit.forces.ForceModel) OrekitException(org.orekit.errors.OrekitException) AstronomicalAmplitudeReader(org.orekit.forces.gravity.potential.AstronomicalAmplitudeReader) Test(org.junit.Test)

Example 4 with ForceModel

use of org.orekit.forces.ForceModel 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)

Example 5 with ForceModel

use of org.orekit.forces.ForceModel in project Orekit by CS-SI.

the class FieldNumericalPropagatorTest method doTestPropagationTypesElliptical.

private <T extends RealFieldElement<T>> void doTestPropagationTypesElliptical(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    // setup
    final FieldAbsoluteDate<T> initDate = FieldAbsoluteDate.getJ2000Epoch(field);
    FieldSpacecraftState<T> initialState;
    FieldNumericalPropagator<T> propagator;
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(7.0e6), zero.add(1.0e6), zero.add(4.0e6));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-500.0), zero.add(8000.0), zero.add(1000.0));
    final FieldOrbit<T> orbit = new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), initDate, mu);
    initialState = new FieldSpacecraftState<>(orbit);
    OrbitType type = OrbitType.EQUINOCTIAL;
    double[][] tolerance = NumericalPropagator.tolerances(0.001, orbit.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<T> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    propagator = new FieldNumericalPropagator<>(field, integrator);
    propagator.setOrbitType(type);
    propagator.setInitialState(initialState);
    ForceModel gravityField = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(5, 5));
    propagator.addForceModel(gravityField);
    // Propagation of the initial at t + dt
    final FieldPVCoordinates<T> pv = initialState.getPVCoordinates();
    final T dP = zero.add(0.001);
    final T dV = pv.getPosition().getNormSq().multiply(pv.getVelocity().getNorm()).reciprocal().multiply(dP.multiply(initialState.getMu()));
    final FieldPVCoordinates<T> pvcM = propagateInType(initialState, dP, OrbitType.CARTESIAN, PositionAngle.MEAN, propagator);
    final FieldPVCoordinates<T> pviM = propagateInType(initialState, dP, OrbitType.CIRCULAR, PositionAngle.MEAN, propagator);
    final FieldPVCoordinates<T> pveM = propagateInType(initialState, dP, OrbitType.EQUINOCTIAL, PositionAngle.MEAN, propagator);
    final FieldPVCoordinates<T> pvkM = propagateInType(initialState, dP, OrbitType.KEPLERIAN, PositionAngle.MEAN, propagator);
    final FieldPVCoordinates<T> pvcE = propagateInType(initialState, dP, OrbitType.CARTESIAN, PositionAngle.ECCENTRIC, propagator);
    final FieldPVCoordinates<T> pviE = propagateInType(initialState, dP, OrbitType.CIRCULAR, PositionAngle.ECCENTRIC, propagator);
    final FieldPVCoordinates<T> pveE = propagateInType(initialState, dP, OrbitType.EQUINOCTIAL, PositionAngle.ECCENTRIC, propagator);
    final FieldPVCoordinates<T> pvkE = propagateInType(initialState, dP, OrbitType.KEPLERIAN, PositionAngle.ECCENTRIC, propagator);
    final FieldPVCoordinates<T> pvcT = propagateInType(initialState, dP, OrbitType.CARTESIAN, PositionAngle.TRUE, propagator);
    final FieldPVCoordinates<T> pviT = propagateInType(initialState, dP, OrbitType.CIRCULAR, PositionAngle.TRUE, propagator);
    final FieldPVCoordinates<T> pveT = propagateInType(initialState, dP, OrbitType.EQUINOCTIAL, PositionAngle.TRUE, propagator);
    final FieldPVCoordinates<T> pvkT = propagateInType(initialState, dP, OrbitType.KEPLERIAN, PositionAngle.TRUE, propagator);
    Assert.assertEquals(0, pvcM.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 3.0);
    Assert.assertEquals(0, pvcM.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 2.0);
    Assert.assertEquals(0, pviM.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 0.6);
    Assert.assertEquals(0, pviM.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.4);
    Assert.assertEquals(0, pvkM.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 0.5);
    Assert.assertEquals(0, pvkM.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.3);
    Assert.assertEquals(0, pveM.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 0.2);
    Assert.assertEquals(0, pveM.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.2);
    Assert.assertEquals(0, pvcE.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 3.0);
    Assert.assertEquals(0, pvcE.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 2.0);
    Assert.assertEquals(0, pviE.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 0.03);
    Assert.assertEquals(0, pviE.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.04);
    Assert.assertEquals(0, pvkE.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 0.4);
    Assert.assertEquals(0, pvkE.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.3);
    Assert.assertEquals(0, pveE.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 0.2);
    Assert.assertEquals(0, pveE.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.07);
    Assert.assertEquals(0, pvcT.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 3.0);
    Assert.assertEquals(0, pvcT.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 2.0);
    Assert.assertEquals(0, pviT.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 0.3);
    Assert.assertEquals(0, pviT.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.2);
    Assert.assertEquals(0, pvkT.getPosition().subtract(pveT.getPosition()).getNorm().getReal() / dP.getReal(), 0.4);
    Assert.assertEquals(0, pvkT.getVelocity().subtract(pveT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.2);
}
Also used : DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) ForceModel(org.orekit.forces.ForceModel) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldEquinoctialOrbit(org.orekit.orbits.FieldEquinoctialOrbit) OrbitType(org.orekit.orbits.OrbitType) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)

Aggregations

ForceModel (org.orekit.forces.ForceModel)37 SpacecraftState (org.orekit.propagation.SpacecraftState)22 Orbit (org.orekit.orbits.Orbit)16 Test (org.junit.Test)15 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)15 NormalizedSphericalHarmonicsProvider (org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider)14 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)14 AbsoluteDate (org.orekit.time.AbsoluteDate)14 HolmesFeatherstoneAttractionModel (org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)13 Frame (org.orekit.frames.Frame)11 OrbitType (org.orekit.orbits.OrbitType)11 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)9 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)9 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)8 UT1Scale (org.orekit.time.UT1Scale)8 TimeScale (org.orekit.time.TimeScale)7 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)6 OrekitException (org.orekit.errors.OrekitException)5 FieldCartesianOrbit (org.orekit.orbits.FieldCartesianOrbit)5 PVCoordinates (org.orekit.utils.PVCoordinates)5