Search in sources :

Example 91 with DateComponents

use of org.orekit.time.DateComponents in project Orekit by CS-SI.

the class HolmesFeatherstoneAttractionModelTest method testZonalWithCunninghamReference.

// test the difference with the Cunningham model
@Test
@Deprecated
public void testZonalWithCunninghamReference() throws OrekitException {
    // 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);
    propagator = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(1000));
    propagator.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(ae, mu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { normalizedC20 }, { normalizedC30 }, { normalizedC40 }, { normalizedC50 }, { normalizedC60 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 } })));
    propagator.setInitialState(new SpacecraftState(orbit));
    SpacecraftState hfOrb = propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    propagator.removeForceModels();
    propagator.addForceModel(new CunninghamAttractionModel(itrf, GravityFieldFactory.getUnnormalizedProvider(ae, mu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { unnormalizedC20 }, { unnormalizedC30 }, { unnormalizedC40 }, { unnormalizedC50 }, { unnormalizedC60 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 } })));
    propagator.setInitialState(new SpacecraftState(orbit));
    SpacecraftState cOrb = propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    Vector3D dif = hfOrb.getPVCoordinates().getPosition().subtract(cOrb.getPVCoordinates().getPosition());
    Assert.assertEquals(0, dif.getNorm(), 2e-9);
    Assert.assertTrue(propagator.getCalls() < 400);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) 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) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) DateComponents(org.orekit.time.DateComponents) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 92 with DateComponents

use of org.orekit.time.DateComponents in project Orekit by CS-SI.

the class HolmesFeatherstoneAttractionModelTest method testStateJacobianVsFiniteDifferences.

@Test
public void testStateJacobianVsFiniteDifferences() 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);
    HolmesFeatherstoneAttractionModel hfModel = new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(50, 50));
    Assert.assertEquals(TideSystem.UNKNOWN, hfModel.getTideSystem());
    SpacecraftState state = new SpacecraftState(orbit);
    checkStateJacobianVsFiniteDifferences(state, hfModel, Propagator.DEFAULT_LAW, 10.0, 2.0e-10, false);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) 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) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) 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 93 with DateComponents

use of org.orekit.time.DateComponents in project Orekit by CS-SI.

the class ThirdBodyAttractionTest method testJacobianVs80Implementation.

@Test
public void testJacobianVs80Implementation() throws OrekitException {
    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 03, 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, Constants.EIGEN5C_EARTH_MU);
    final CelestialBody moon = CelestialBodyFactory.getMoon();
    final ThirdBodyAttraction forceModel = new ThirdBodyAttraction(moon);
    checkStateJacobianVs80Implementation(new SpacecraftState(orbit), forceModel, new LofOffset(orbit.getFrame(), LOFType.VVLH), 1.0e-50, false);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) 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) CelestialBody(org.orekit.bodies.CelestialBody) DateComponents(org.orekit.time.DateComponents) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) LofOffset(org.orekit.attitudes.LofOffset) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 94 with DateComponents

use of org.orekit.time.DateComponents 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 95 with DateComponents

use of org.orekit.time.DateComponents in project Orekit by CS-SI.

the class PartialDerivativesTest method testJacobianIssue18.

@Test
public void testJacobianIssue18() throws OrekitException {
    // Body mu
    final double mu = 3.9860047e14;
    final double isp = 318;
    final double mass = 2500;
    final double a = 24396159;
    final double e = 0.72831215;
    final double i = FastMath.toRadians(7);
    final double omega = FastMath.toRadians(180);
    final double OMEGA = FastMath.toRadians(261);
    final double lv = 0;
    final double duration = 3653.99;
    final double f = 420;
    final double delta = FastMath.toRadians(-7.4978);
    final double alpha = FastMath.toRadians(351);
    final AttitudeProvider law = new InertialProvider(new Rotation(new Vector3D(alpha, delta), Vector3D.PLUS_I));
    final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC());
    final Orbit orbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
    final SpacecraftState initialState = new SpacecraftState(orbit, law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);
    final AbsoluteDate fireDate = new AbsoluteDate(new DateComponents(2004, 01, 02), new TimeComponents(04, 15, 34.080), TimeScalesFactory.getUTC());
    final ConstantThrustManeuver maneuver = new ConstantThrustManeuver(fireDate, duration, f, isp, Vector3D.PLUS_I);
    double[] absTolerance = { 0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001 };
    double[] relTolerance = { 1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7 };
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, absTolerance, relTolerance);
    integrator.setInitialStepSize(60);
    final NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setAttitudeProvider(law);
    propagator.addForceModel(maneuver);
    maneuver.getParameterDriver("thrust").setSelected(true);
    propagator.setOrbitType(OrbitType.CARTESIAN);
    PartialDerivativesEquations PDE = new PartialDerivativesEquations("derivatives", propagator);
    Assert.assertEquals(1, PDE.getSelectedParameters().getNbParams());
    propagator.setInitialState(PDE.setInitialJacobians(initialState));
    final AbsoluteDate finalDate = fireDate.shiftedBy(3800);
    final SpacecraftState finalorb = propagator.propagate(finalDate);
    Assert.assertEquals(0, finalDate.durationFrom(finalorb.getDate()), 1.0e-11);
}
Also used : KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) InertialProvider(org.orekit.attitudes.InertialProvider) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) ConstantThrustManeuver(org.orekit.forces.maneuvers.ConstantThrustManeuver) Test(org.junit.Test)

Aggregations

DateComponents (org.orekit.time.DateComponents)148 AbsoluteDate (org.orekit.time.AbsoluteDate)129 Test (org.junit.Test)98 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)87 TimeComponents (org.orekit.time.TimeComponents)87 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)64 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)62 Orbit (org.orekit.orbits.Orbit)47 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)46 SpacecraftState (org.orekit.propagation.SpacecraftState)45 PVCoordinates (org.orekit.utils.PVCoordinates)40 CartesianOrbit (org.orekit.orbits.CartesianOrbit)37 OrekitException (org.orekit.errors.OrekitException)34 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)33 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)28 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)28 CircularOrbit (org.orekit.orbits.CircularOrbit)25 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)25 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)23 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)22