Search in sources :

Example 1 with Frame

use of org.orekit.frames.Frame in project SpriteOrbits by ProjectPersephone.

the class SpriteProp method main.

/**
 * @param args
 */
public static void main(String[] args) {
    PrintStream out = null;
    try {
        // set up orekit data
        // for this to work, the orekit-data.zip file avaiable at the following URL
        // must be put in the current working directory
        // URL:     https://www.orekit.org/forge/projects/orekit/files
        File userDir = new File(System.getProperty("user.dir"));
        File orekitZip = new File(userDir, "orekit-data.zip");
        DataProvidersManager.getInstance().addProvider(new ZipJarCrawler(orekitZip));
        // reference models
        // this is the frame labeled J2K in the NASA page
        final Frame eme2000 = FramesFactory.getEME2000();
        final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
        final TimeScale utc = TimeScalesFactory.getUTC();
        // central attraction coefficient MU
        final double mu = Constants.EIGEN5C_EARTH_MU;
        // set up some data, ideally, this should be provided as input to the program
        // ISS orbit is from http://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/orbit/ISS/SVPOST.html
        // 
        // Coasting Arc #15 (Orbit 3386)
        // ---------------------------------------
        // 
        // Vector Time (GMT): 2014/055/16:27:06.921
        // Vector Time (MET): N/A
        // Weight (LBS)     : 911651.1
        // 
        // ...
        // 
        // J2K Cartesian
        // --------------------------------
        // X    =         2998767.75
        // Y    =        -6097451.56  meter
        // ...              Z    =         -141448.92
        // XDOT =        4323.077242
        // YDOT =        1994.291706  meter/sec
        // ZDOT =        6000.774574
        // we start small, we can increase this later
        final int numberOfSprites = 12;
        // (m/s)
        final double relativeReleaseVelocity = 1.0;
        final AbsoluteDate releaseDate = new // year, month, day
        AbsoluteDate(// year, month, day
        2014, // year, month, day
        3, // year, month, day
        1, // hours, minutes, seconds
        12, // hours, minutes, seconds
        0, // hours, minutes, seconds
        0.0, utc);
        final CartesianOrbit kickSatOrbit = new CartesianOrbit(new // position (m)
        PVCoordinates(// position (m)
        new Vector3D(2998767.75, -6097451.56, -141448.92), // velocity (m/s)
        new Vector3D(4323.077242, 1994.291706, 6000.774574)), eme2000, new // year, day in year as NASA page above
        AbsoluteDate(// year, day in year as NASA page above
        new DateComponents(2014, 55), // hour in day
        new TimeComponents(16, 27, 6.921), utc), mu);
        // kg
        final double kickSatMass = 10.0;
        // m^2
        final double kickSatCrossSection = 0.03;
        // no units
        final double kickSatDragCoeff = 2.2;
        // kg
        final double spriteMass = 0.01;
        // m^2
        final double spriteCrossSection = 2.5e-3;
        // no units
        final double spriteDragCoeff = 2.2;
        SpriteProp spriteProp = new SpriteProp(numberOfSprites, kickSatOrbit, kickSatMass, kickSatCrossSection, kickSatDragCoeff, spriteMass, spriteCrossSection, spriteDragCoeff, relativeReleaseVelocity, releaseDate, itrf);
        // days after release
        final double propagationDuration = 0.2;
        // seconds
        final double step = 60.0;
        // out = new PrintStream(new File(userDir, "sprites-prop.txt"));
        out = new PrintStream(new File(userDir, "orbits.json"));
        out.format(Locale.US, "[");
        spriteProp.run(out, propagationDuration, step, utc);
        out.format(Locale.US, "]");
    } catch (IOException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (OrekitException e) {
        e.printStackTrace();
    } finally {
        if (out != null) {
            out.close();
        }
    }
}
Also used : PrintStream(java.io.PrintStream) Frame(org.orekit.frames.Frame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) IOException(java.io.IOException) TimeScale(org.orekit.time.TimeScale) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AbsoluteDate(org.orekit.time.AbsoluteDate) Vector3D(org.apache.commons.math3.geometry.euclidean.threed.Vector3D) ZipJarCrawler(org.orekit.data.ZipJarCrawler) OrekitException(org.orekit.errors.OrekitException) File(java.io.File)

Example 2 with Frame

use of org.orekit.frames.Frame in project SpriteOrbits by ProjectPersephone.

the class SpritePropOrig method main.

/**
 * @param args
 */
public static void main(String[] args) {
    PrintStream out = null;
    try {
        // set up orekit data
        // for this to work, the orekit-data.zip file avaiable at the following URL
        // must be put in the current working directory
        // URL:     https://www.orekit.org/forge/projects/orekit/files
        File userDir = new File(System.getProperty("user.dir"));
        File orekitZip = new File(userDir, "orekit-data.zip");
        DataProvidersManager.getInstance().addProvider(new ZipJarCrawler(orekitZip));
        // reference models
        // this is the frame labeled J2K in the NASA page
        final Frame eme2000 = FramesFactory.getEME2000();
        final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
        final TimeScale utc = TimeScalesFactory.getUTC();
        // central attraction coefficient MU
        final double mu = Constants.EIGEN5C_EARTH_MU;
        // set up some data, ideally, this should be provided as input to the program
        // ISS orbit is from http://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/orbit/ISS/SVPOST.html
        // 
        // Coasting Arc #15 (Orbit 3386)
        // ---------------------------------------
        // 
        // Vector Time (GMT): 2014/055/16:27:06.921
        // Vector Time (MET): N/A
        // Weight (LBS)     : 911651.1
        // 
        // ...
        // 
        // J2K Cartesian
        // --------------------------------
        // X    =         2998767.75
        // Y    =        -6097451.56  meter
        // ...              Z    =         -141448.92
        // XDOT =        4323.077242
        // YDOT =        1994.291706  meter/sec
        // ZDOT =        6000.774574
        // we start small, we can increase this later
        final int numberOfSprites = 12;
        // (m/s)
        final double relativeReleaseVelocity = 1.0;
        final AbsoluteDate releaseDate = new // year, month, day
        AbsoluteDate(// year, month, day
        2014, // year, month, day
        3, // year, month, day
        1, // hours, minutes, seconds
        12, // hours, minutes, seconds
        0, // hours, minutes, seconds
        0.0, utc);
        final CartesianOrbit kickSatOrbit = new CartesianOrbit(new // position (m)
        PVCoordinates(// position (m)
        new Vector3D(2998767.75, -6097451.56, -141448.92), // velocity (m/s)
        new Vector3D(4323.077242, 1994.291706, 6000.774574)), eme2000, new // year, day in year as NASA page above
        AbsoluteDate(// year, day in year as NASA page above
        new DateComponents(2014, 55), // hour in day
        new TimeComponents(16, 27, 6.921), utc), mu);
        // kg
        final double kickSatMass = 10.0;
        // m^2
        final double kickSatCrossSection = 0.03;
        // no units
        final double kickSatDragCoeff = 2.2;
        // kg
        final double spriteMass = 0.01;
        // m^2
        final double spriteCrossSection = 2.5e-3;
        // no units
        final double spriteDragCoeff = 2.2;
        SpritePropOrig spriteProp = new SpritePropOrig(numberOfSprites, kickSatOrbit, kickSatMass, kickSatCrossSection, kickSatDragCoeff, spriteMass, spriteCrossSection, spriteDragCoeff, relativeReleaseVelocity, releaseDate, itrf);
        // days after release
        final double propagationDuration = 0.2;
        // seconds
        final double step = 60.0;
        out = new PrintStream(new File(userDir, "sprites-prop.txt"));
        spriteProp.run(out, propagationDuration, step, utc);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (OrekitException e) {
        e.printStackTrace();
    } finally {
        if (out != null) {
            out.close();
        }
    }
}
Also used : PrintStream(java.io.PrintStream) Frame(org.orekit.frames.Frame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) IOException(java.io.IOException) TimeScale(org.orekit.time.TimeScale) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AbsoluteDate(org.orekit.time.AbsoluteDate) Vector3D(org.apache.commons.math3.geometry.euclidean.threed.Vector3D) ZipJarCrawler(org.orekit.data.ZipJarCrawler) OrekitException(org.orekit.errors.OrekitException) File(java.io.File)

Example 3 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class BoxAndSolarArraySpacecraftTest method testLiftVsNoLift.

@Test
public void testLiftVsNoLift() throws OrekitException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    CelestialBody sun = CelestialBodyFactory.getSun();
    // older implementation did not consider lift, so it really worked
    // only for symmetrical shapes. For testing purposes, we will use a
    // basic cubic shape without solar arrays and a relative atmosphere
    // velocity either *exactly* facing a side or *exactly* along a main diagonal
    BoxAndSolarArraySpacecraft.Facet[] facets = new BoxAndSolarArraySpacecraft.Facet[] { new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_I, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_I, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_J, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_J, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_K, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_K, 3.0) };
    BoxAndSolarArraySpacecraft cube = new BoxAndSolarArraySpacecraft(facets, sun, 0.0, Vector3D.PLUS_J, 1.0, 1.0, 1.0, 0.0);
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Frame frame = FramesFactory.getEME2000();
    Vector3D position = new Vector3D(1234567.8, 9876543.21, 121212.3434);
    double mass = 1000.0;
    double density = 0.001;
    Rotation rotation = Rotation.IDENTITY;
    // head-on, there acceleration with lift should be twice acceleration without lift
    Vector3D headOnVelocity = new Vector3D(2000, 0.0, 0.0);
    Vector3D newHeadOnDrag = cube.dragAcceleration(date, frame, position, rotation, mass, density, headOnVelocity, getDragParameters(cube));
    Vector3D oldHeadOnDrag = oldDragAcceleration(cube, date, frame, position, rotation, mass, density, headOnVelocity);
    Assert.assertThat(newHeadOnDrag, OrekitMatchers.vectorCloseTo(oldHeadOnDrag.scalarMultiply(2), 1));
    // on an angle, the no lift implementation applies drag to the velocity direction
    // instead of to the facet normal direction. In the symmetrical case, this implies
    // it applied a single cos(θ) coefficient (projected surface reduction) instead
    // of using cos²(θ) (projected surface reduction *and* normal component projection)
    // and since molecule is reflected backward with the same velocity, this implies a
    // factor 2 in linear momentum differences
    Vector3D diagonalVelocity = new Vector3D(2000, 2000, 2000);
    Vector3D newDiagDrag = cube.dragAcceleration(date, frame, position, rotation, mass, density, diagonalVelocity, getDragParameters(cube));
    Vector3D oldDiagDrag = oldDragAcceleration(cube, date, frame, position, rotation, mass, density, diagonalVelocity);
    double oldMissingCoeff = 2.0 / FastMath.sqrt(3.0);
    Vector3D fixedOldDrag = new Vector3D(oldMissingCoeff, oldDiagDrag);
    Assert.assertThat(newDiagDrag, OrekitMatchers.vectorCloseTo(fixedOldDrag, 1));
}
Also used : Frame(org.orekit.frames.Frame) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) CelestialBody(org.orekit.bodies.CelestialBody) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 4 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class DragForceTest method RealFieldExpectErrorTest.

/**
 *Same test as the previous one but not adding the ForceModel to the NumericalPropagator
 *    it is a test to validate the previous test.
 *    (to test if the ForceModel it's actually
 *    doing something in the Propagator and the FieldPropagator)
 */
@Test
public void RealFieldExpectErrorTest() throws OrekitException {
    DSFactory factory = new DSFactory(6, 5);
    DerivativeStructure a_0 = factory.variable(0, 7e6);
    DerivativeStructure e_0 = factory.variable(1, 0.01);
    DerivativeStructure i_0 = factory.variable(2, 85 * FastMath.PI / 180);
    DerivativeStructure R_0 = factory.variable(3, 0.7);
    DerivativeStructure O_0 = factory.variable(4, 0.5);
    DerivativeStructure n_0 = factory.variable(5, 0.1);
    Field<DerivativeStructure> field = a_0.getField();
    DerivativeStructure zero = field.getZero();
    FieldAbsoluteDate<DerivativeStructure> J2000 = new FieldAbsoluteDate<>(field);
    Frame EME = FramesFactory.getEME2000();
    FieldKeplerianOrbit<DerivativeStructure> FKO = new FieldKeplerianOrbit<>(a_0, e_0, i_0, R_0, O_0, n_0, PositionAngle.MEAN, EME, J2000, Constants.EIGEN5C_EARTH_MU);
    FieldSpacecraftState<DerivativeStructure> initialState = new FieldSpacecraftState<>(FKO);
    SpacecraftState iSR = initialState.toSpacecraftState();
    OrbitType type = OrbitType.KEPLERIAN;
    double[][] tolerance = NumericalPropagator.tolerances(10.0, FKO.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<DerivativeStructure> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    AdaptiveStepsizeIntegrator RIntegrator = new DormandPrince853Integrator(0.001, 200, tolerance[0], tolerance[1]);
    RIntegrator.setInitialStepSize(60);
    FieldNumericalPropagator<DerivativeStructure> FNP = new FieldNumericalPropagator<>(field, integrator);
    FNP.setOrbitType(type);
    FNP.setInitialState(initialState);
    NumericalPropagator NP = new NumericalPropagator(RIntegrator);
    NP.setOrbitType(type);
    NP.setInitialState(iSR);
    final DragForce forceModel = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(), new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true))), new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8, CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J, 1.2, 0.7, 0.2));
    FNP.addForceModel(forceModel);
    // NOT ADDING THE FORCE MODEL TO THE NUMERICAL PROPAGATOR   NP.addForceModel(forceModel);
    FieldAbsoluteDate<DerivativeStructure> target = J2000.shiftedBy(1000.);
    FieldSpacecraftState<DerivativeStructure> finalState_DS = FNP.propagate(target);
    SpacecraftState finalState_R = NP.propagate(target.toAbsoluteDate());
    FieldPVCoordinates<DerivativeStructure> finPVC_DS = finalState_DS.getPVCoordinates();
    PVCoordinates finPVC_R = finalState_R.getPVCoordinates();
    Assert.assertFalse(FastMath.abs(finPVC_DS.toPVCoordinates().getPosition().getX() - finPVC_R.getPosition().getX()) < FastMath.abs(finPVC_R.getPosition().getX()) * 1e-11);
    Assert.assertFalse(FastMath.abs(finPVC_DS.toPVCoordinates().getPosition().getY() - finPVC_R.getPosition().getY()) < FastMath.abs(finPVC_R.getPosition().getY()) * 1e-11);
    Assert.assertFalse(FastMath.abs(finPVC_DS.toPVCoordinates().getPosition().getZ() - finPVC_R.getPosition().getZ()) < FastMath.abs(finPVC_R.getPosition().getZ()) * 1e-11);
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) BoxAndSolarArraySpacecraft(org.orekit.forces.BoxAndSolarArraySpacecraft) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) OrbitType(org.orekit.orbits.OrbitType) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 5 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class DragForceTest method RealFieldTest.

/**
 *Testing if the propagation between the FieldPropagation and the propagation
 * is equivalent.
 * Also testing if propagating X+dX with the propagation is equivalent to
 * propagation X with the FieldPropagation and then applying the taylor
 * expansion of dX to the result.
 */
@Test
public void RealFieldTest() throws OrekitException {
    DSFactory factory = new DSFactory(6, 4);
    DerivativeStructure a_0 = factory.variable(0, 7e6);
    DerivativeStructure e_0 = factory.variable(1, 0.01);
    DerivativeStructure i_0 = factory.variable(2, 1.2);
    DerivativeStructure R_0 = factory.variable(3, 0.7);
    DerivativeStructure O_0 = factory.variable(4, 0.5);
    DerivativeStructure n_0 = factory.variable(5, 0.1);
    Field<DerivativeStructure> field = a_0.getField();
    DerivativeStructure zero = field.getZero();
    FieldAbsoluteDate<DerivativeStructure> J2000 = new FieldAbsoluteDate<>(field);
    Frame EME = FramesFactory.getEME2000();
    FieldKeplerianOrbit<DerivativeStructure> FKO = new FieldKeplerianOrbit<>(a_0, e_0, i_0, R_0, O_0, n_0, PositionAngle.MEAN, EME, J2000, Constants.EIGEN5C_EARTH_MU);
    FieldSpacecraftState<DerivativeStructure> initialState = new FieldSpacecraftState<>(FKO);
    SpacecraftState iSR = initialState.toSpacecraftState();
    ClassicalRungeKuttaFieldIntegrator<DerivativeStructure> integrator = new ClassicalRungeKuttaFieldIntegrator<>(field, zero.add(6));
    ClassicalRungeKuttaIntegrator RIntegrator = new ClassicalRungeKuttaIntegrator(6);
    OrbitType type = OrbitType.EQUINOCTIAL;
    FieldNumericalPropagator<DerivativeStructure> FNP = new FieldNumericalPropagator<>(field, integrator);
    FNP.setOrbitType(type);
    FNP.setInitialState(initialState);
    NumericalPropagator NP = new NumericalPropagator(RIntegrator);
    NP.setOrbitType(type);
    NP.setInitialState(iSR);
    final DragForce forceModel = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(), new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true))), new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8, CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J, 1.2, 0.7, 0.2));
    FNP.addForceModel(forceModel);
    NP.addForceModel(forceModel);
    FieldAbsoluteDate<DerivativeStructure> target = J2000.shiftedBy(1000.);
    FieldSpacecraftState<DerivativeStructure> finalState_DS = FNP.propagate(target);
    SpacecraftState finalState_R = NP.propagate(target.toAbsoluteDate());
    FieldPVCoordinates<DerivativeStructure> finPVC_DS = finalState_DS.getPVCoordinates();
    PVCoordinates finPVC_R = finalState_R.getPVCoordinates();
    Assert.assertEquals(finPVC_DS.toPVCoordinates().getPosition().getX(), finPVC_R.getPosition().getX(), FastMath.abs(finPVC_R.getPosition().getX()) * 1e-11);
    Assert.assertEquals(finPVC_DS.toPVCoordinates().getPosition().getY(), finPVC_R.getPosition().getY(), FastMath.abs(finPVC_R.getPosition().getY()) * 1e-11);
    Assert.assertEquals(finPVC_DS.toPVCoordinates().getPosition().getZ(), finPVC_R.getPosition().getZ(), FastMath.abs(finPVC_R.getPosition().getZ()) * 1e-11);
    long number = 23091991;
    RandomGenerator RG = new Well19937a(number);
    GaussianRandomGenerator NGG = new GaussianRandomGenerator(RG);
    UncorrelatedRandomVectorGenerator URVG = new UncorrelatedRandomVectorGenerator(new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, new double[] { 1e3, 0.005, 0.005, 0.01, 0.01, 0.01 }, NGG);
    double a_R = a_0.getReal();
    double e_R = e_0.getReal();
    double i_R = i_0.getReal();
    double R_R = R_0.getReal();
    double O_R = O_0.getReal();
    double n_R = n_0.getReal();
    for (int ii = 0; ii < 1; ii++) {
        double[] rand_next = URVG.nextVector();
        double a_shift = a_R + rand_next[0];
        double e_shift = e_R + rand_next[1];
        double i_shift = i_R + rand_next[2];
        double R_shift = R_R + rand_next[3];
        double O_shift = O_R + rand_next[4];
        double n_shift = n_R + rand_next[5];
        KeplerianOrbit shiftedOrb = new KeplerianOrbit(a_shift, e_shift, i_shift, R_shift, O_shift, n_shift, PositionAngle.MEAN, EME, J2000.toAbsoluteDate(), Constants.EIGEN5C_EARTH_MU);
        SpacecraftState shift_iSR = new SpacecraftState(shiftedOrb);
        NumericalPropagator shift_NP = new NumericalPropagator(RIntegrator);
        shift_NP.setInitialState(shift_iSR);
        shift_NP.addForceModel(forceModel);
        SpacecraftState finalState_shift = shift_NP.propagate(target.toAbsoluteDate());
        PVCoordinates finPVC_shift = finalState_shift.getPVCoordinates();
        // position check
        FieldVector3D<DerivativeStructure> pos_DS = finPVC_DS.getPosition();
        double x_DS = pos_DS.getX().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double y_DS = pos_DS.getY().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double z_DS = pos_DS.getZ().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        // System.out.println(pos_DS.getX().getPartialDerivative(1));
        double x = finPVC_shift.getPosition().getX();
        double y = finPVC_shift.getPosition().getY();
        double z = finPVC_shift.getPosition().getZ();
        Assert.assertEquals(x_DS, x, FastMath.abs(x - pos_DS.getX().getReal()) * 1e-5);
        Assert.assertEquals(y_DS, y, FastMath.abs(y - pos_DS.getY().getReal()) * 1e-5);
        Assert.assertEquals(z_DS, z, FastMath.abs(z - pos_DS.getZ().getReal()) * 1e-5);
        // velocity check
        FieldVector3D<DerivativeStructure> vel_DS = finPVC_DS.getVelocity();
        double vx_DS = vel_DS.getX().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double vy_DS = vel_DS.getY().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double vz_DS = vel_DS.getZ().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double vx = finPVC_shift.getVelocity().getX();
        double vy = finPVC_shift.getVelocity().getY();
        double vz = finPVC_shift.getVelocity().getZ();
        Assert.assertEquals(vx_DS, vx, FastMath.abs(vx) * 1e-7);
        Assert.assertEquals(vy_DS, vy, FastMath.abs(vy) * 1e-7);
        Assert.assertEquals(vz_DS, vz, FastMath.abs(vz) * 1e-7);
        // acceleration check
        FieldVector3D<DerivativeStructure> acc_DS = finPVC_DS.getAcceleration();
        double ax_DS = acc_DS.getX().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double ay_DS = acc_DS.getY().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double az_DS = acc_DS.getZ().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double ax = finPVC_shift.getAcceleration().getX();
        double ay = finPVC_shift.getAcceleration().getY();
        double az = finPVC_shift.getAcceleration().getZ();
        Assert.assertEquals(ax_DS, ax, FastMath.abs(ax) * 1e-5);
        Assert.assertEquals(ay_DS, ay, FastMath.abs(ay) * 1e-5);
        Assert.assertEquals(az_DS, az, FastMath.abs(az) * 1e-5);
    }
}
Also used : Frame(org.orekit.frames.Frame) ClassicalRungeKuttaFieldIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaFieldIntegrator) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) GaussianRandomGenerator(org.hipparchus.random.GaussianRandomGenerator) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) Well19937a(org.hipparchus.random.Well19937a) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) RandomGenerator(org.hipparchus.random.RandomGenerator) GaussianRandomGenerator(org.hipparchus.random.GaussianRandomGenerator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) BoxAndSolarArraySpacecraft(org.orekit.forces.BoxAndSolarArraySpacecraft) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) OrbitType(org.orekit.orbits.OrbitType) UncorrelatedRandomVectorGenerator(org.hipparchus.random.UncorrelatedRandomVectorGenerator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Aggregations

Frame (org.orekit.frames.Frame)257 Test (org.junit.Test)169 AbsoluteDate (org.orekit.time.AbsoluteDate)153 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)117 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)99 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)79 SpacecraftState (org.orekit.propagation.SpacecraftState)79 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)70 OrekitException (org.orekit.errors.OrekitException)60 PVCoordinates (org.orekit.utils.PVCoordinates)58 Orbit (org.orekit.orbits.Orbit)51 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)50 TimeScale (org.orekit.time.TimeScale)46 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)46 GeodeticPoint (org.orekit.bodies.GeodeticPoint)41 TopocentricFrame (org.orekit.frames.TopocentricFrame)38 Transform (org.orekit.frames.Transform)38 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)35 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)33 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)31