Search in sources :

Example 1 with OrekitException

use of org.orekit.errors.OrekitException 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 OrekitException

use of org.orekit.errors.OrekitException 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 OrekitException

use of org.orekit.errors.OrekitException in project Orekit by CS-SI.

the class BoxAndSolarArraySpacecraftTest method testWrongParameterRadiation.

@Test
public void testWrongParameterRadiation() throws OrekitException {
    SpacecraftState state = propagator.getInitialState();
    CelestialBody sun = CelestialBodyFactory.getSun();
    BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, sun, 20.0, Vector3D.PLUS_J, 0.0, 1.0, 0.0);
    try {
        s.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), Vector3D.PLUS_I, getRadiationParameters(s), "wrong");
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
        Assert.assertEquals("wrong", (String) oe.getParts()[0]);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) CelestialBody(org.orekit.bodies.CelestialBody) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 4 with OrekitException

use of org.orekit.errors.OrekitException in project Orekit by CS-SI.

the class PolynomialParametricAccelerationTest method setUp.

@Before
public void setUp() {
    try {
        Utils.setDataRoot("regular-data");
        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 AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC());
        initialOrbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, Constants.EIGEN5C_EARTH_MU);
    } catch (OrekitException oe) {
        Assert.fail(oe.getLocalizedMessage());
    }
}
Also used : DateComponents(org.orekit.time.DateComponents) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Example 5 with OrekitException

use of org.orekit.errors.OrekitException in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method testWithPropagator.

/**
 * Check integration error is small when integrating the same equations over the same
 * interval.
 *
 * @throws OrekitException on error.
 */
@Test
public void testWithPropagator() throws OrekitException {
    CelestialBody sun = CelestialBodyFactory.getSun();
    final Frame eci = FramesFactory.getGCRF();
    final Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    AbsoluteDate date = new AbsoluteDate(2004, 1, 1, utc);
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, ecef);
    Orbit orbit = new KeplerianOrbit(6378137 + 400e3, 1e-3, FastMath.toRadians(50), 0, 0, 0, PositionAngle.TRUE, eci, date, Constants.EIGEN5C_EARTH_MU);
    final SpacecraftState ic = new SpacecraftState(orbit);
    final AbsoluteDate end = date.shiftedBy(5 * Constants.JULIAN_DAY);
    final AbsoluteDate resetDate = date.shiftedBy(0.8 * Constants.JULIAN_DAY + 0.1);
    final SpacecraftState[] lastState = new SpacecraftState[1];
    final OrekitStepHandler stepSaver = (interpolator, isLast) -> {
        final AbsoluteDate start = interpolator.getPreviousState().getDate();
        if (start.compareTo(resetDate) < 0) {
            lastState[0] = interpolator.getPreviousState();
        }
    };
    // propagate with state rest to take slightly different path
    NumericalPropagator propagator = getNumericalPropagator(sun, earth, ic);
    propagator.setMasterMode(stepSaver);
    propagator.propagate(resetDate);
    propagator.resetInitialState(lastState[0]);
    propagator.setSlaveMode();
    final SpacecraftState actual = propagator.propagate(end);
    // propagate straight through
    propagator = getNumericalPropagator(sun, earth, ic);
    propagator.resetInitialState(ic);
    propagator.setSlaveMode();
    final SpacecraftState expected = propagator.propagate(end);
    assertThat(actual.getPVCoordinates(), pvCloseTo(expected.getPVCoordinates(), 1.0));
}
Also used : OrekitStepHandler(org.orekit.propagation.sampling.OrekitStepHandler) DTM2000InputParameters(org.orekit.forces.drag.atmosphere.DTM2000InputParameters) Frame(org.orekit.frames.Frame) TimeScale(org.orekit.time.TimeScale) DragForce(org.orekit.forces.drag.DragForce) IERSConventions(org.orekit.utils.IERSConventions) Orbit(org.orekit.orbits.Orbit) StrengthLevel(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation.StrengthLevel) CelestialBody(org.orekit.bodies.CelestialBody) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) SpacecraftState(org.orekit.propagation.SpacecraftState) After(org.junit.After) OrbitType(org.orekit.orbits.OrbitType) PositionAngle(org.orekit.orbits.PositionAngle) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) FastMath(org.hipparchus.util.FastMath) Utils(org.orekit.Utils) Before(org.junit.Before) Constants(org.orekit.utils.Constants) DTM2000(org.orekit.forces.drag.atmosphere.DTM2000) DateComponents(org.orekit.time.DateComponents) FramesFactory(org.orekit.frames.FramesFactory) Atmosphere(org.orekit.forces.drag.atmosphere.Atmosphere) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitMatchers(org.orekit.OrekitMatchers) Test(org.junit.Test) MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) DataProvidersManager(org.orekit.data.DataProvidersManager) Month(org.orekit.time.Month) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) OrekitException(org.orekit.errors.OrekitException) CelestialBodyFactory(org.orekit.bodies.CelestialBodyFactory) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) TimeScalesFactory(org.orekit.time.TimeScalesFactory) IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) Assert(org.junit.Assert) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) CelestialBody(org.orekit.bodies.CelestialBody) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) AbsoluteDate(org.orekit.time.AbsoluteDate) OrekitStepHandler(org.orekit.propagation.sampling.OrekitStepHandler) Test(org.junit.Test)

Aggregations

OrekitException (org.orekit.errors.OrekitException)332 AbsoluteDate (org.orekit.time.AbsoluteDate)150 Test (org.junit.Test)135 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)91 SpacecraftState (org.orekit.propagation.SpacecraftState)75 Frame (org.orekit.frames.Frame)62 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)59 ArrayList (java.util.ArrayList)48 Before (org.junit.Before)48 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)42 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)42 DateComponents (org.orekit.time.DateComponents)42 GeodeticPoint (org.orekit.bodies.GeodeticPoint)41 Orbit (org.orekit.orbits.Orbit)40 PVCoordinates (org.orekit.utils.PVCoordinates)37 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)36 IOException (java.io.IOException)32 InputStream (java.io.InputStream)31 Propagator (org.orekit.propagation.Propagator)30 UnivariateFunction (org.hipparchus.analysis.UnivariateFunction)28