Search in sources :

Example 1 with DataProvidersManager

use of org.orekit.data.DataProvidersManager in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method testExtraData.

@Test(expected = OrekitException.class)
public void testExtraData() throws OrekitException {
    MarshallSolarActivityFutureEstimation msafe = new MarshallSolarActivityFutureEstimation("Jan2011F10-extra-data\\.txt", MarshallSolarActivityFutureEstimation.StrengthLevel.STRONG);
    DataProvidersManager manager = DataProvidersManager.getInstance();
    manager.feed(msafe.getSupportedNames(), msafe);
}
Also used : MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) DataProvidersManager(org.orekit.data.DataProvidersManager) Test(org.junit.Test)

Example 2 with DataProvidersManager

use of org.orekit.data.DataProvidersManager in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method testNoData.

@Test(expected = OrekitException.class)
public void testNoData() throws OrekitException {
    MarshallSolarActivityFutureEstimation msafe = new MarshallSolarActivityFutureEstimation("Jan2011F10-no-data\\.txt", MarshallSolarActivityFutureEstimation.StrengthLevel.STRONG);
    DataProvidersManager manager = DataProvidersManager.getInstance();
    manager.feed(msafe.getSupportedNames(), msafe);
}
Also used : MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) DataProvidersManager(org.orekit.data.DataProvidersManager) Test(org.junit.Test)

Example 3 with DataProvidersManager

use of org.orekit.data.DataProvidersManager in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method loadMsafe.

private MarshallSolarActivityFutureEstimation loadMsafe(MarshallSolarActivityFutureEstimation.StrengthLevel strength) throws OrekitException {
    MarshallSolarActivityFutureEstimation msafe = new MarshallSolarActivityFutureEstimation("(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\p{Digit}\\p{Digit}\\p{Digit}\\p{Digit}F10\\.(?:txt|TXT)", strength);
    DataProvidersManager manager = DataProvidersManager.getInstance();
    manager.feed(msafe.getSupportedNames(), msafe);
    return msafe;
}
Also used : MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) DataProvidersManager(org.orekit.data.DataProvidersManager)

Example 4 with DataProvidersManager

use of org.orekit.data.DataProvidersManager in project Orekit by CS-SI.

the class DSSTPropagation method main.

/**
 * Program entry point.
 * @param args program arguments
 */
public static void main(String[] args) {
    try {
        // configure Orekit
        File home = new File(System.getProperty("user.home"));
        File orekitData = new File(home, "orekit-data");
        if (!orekitData.exists()) {
            System.err.format(Locale.US, "Failed to find %s folder%n", orekitData.getAbsolutePath());
            System.err.format(Locale.US, "You need to download %s from the %s page and unzip it in %s for this tutorial to work%n", "orekit-data.zip", "https://www.orekit.org/forge/projects/orekit/files", home.getAbsolutePath());
            System.exit(1);
        }
        DataProvidersManager manager = DataProvidersManager.getInstance();
        manager.addProvider(new DirectoryCrawler(orekitData));
        // input/output (in user's home directory)
        File input = new File(new File(System.getProperty("user.home")), "dsst-propagation.in");
        File output = new File(input.getParentFile(), "dsst-propagation.out");
        new DSSTPropagation().run(input, output);
    } catch (IOException ioe) {
        System.err.println(ioe.getLocalizedMessage());
        System.exit(1);
    } catch (IllegalArgumentException iae) {
        System.err.println(iae.getLocalizedMessage());
        System.exit(1);
    } catch (OrekitException oe) {
        System.err.println(oe.getLocalizedMessage());
        System.exit(1);
    } catch (ParseException pe) {
        System.err.println(pe.getLocalizedMessage());
        System.exit(1);
    }
}
Also used : DirectoryCrawler(org.orekit.data.DirectoryCrawler) DataProvidersManager(org.orekit.data.DataProvidersManager) OrekitException(org.orekit.errors.OrekitException) IOException(java.io.IOException) ParseException(java.text.ParseException) File(java.io.File)

Example 5 with DataProvidersManager

use of org.orekit.data.DataProvidersManager in project Orekit by CS-SI.

the class FieldPropagation method main.

/**
 * Program entry point.
 * @param args program arguments (unused here)
 * @throws IOException
 * @throws OrekitException
 */
public static void main(String[] args) throws IOException, OrekitException {
    // the goal of this example is to make a Montecarlo simulation giving an error on the semiaxis,
    // the inclination and the RAAN. The interest of doing it with Orekit based on the
    // DerivativeStructure is that instead of doing a large number of propagation around the initial
    // point we will do a single propagation of the initial state, and thanks to the Taylor expansion
    // we will see the evolution of the std deviation of the position, which is divided in the
    // CrossTrack, the LongTrack and the Radial error.
    // configure Orekit
    File home = new File(System.getProperty("user.home"));
    File orekitData = new File(home, "orekit-data");
    if (!orekitData.exists()) {
        System.err.format(Locale.US, "Failed to find %s folder%n", orekitData.getAbsolutePath());
        System.err.format(Locale.US, "You need to download %s from the %s page and unzip it in %s for this tutorial to work%n", "orekit-data.zip", "https://www.orekit.org/forge/projects/orekit/files", home.getAbsolutePath());
        System.exit(1);
    }
    DataProvidersManager manager = DataProvidersManager.getInstance();
    manager.addProvider(new DirectoryCrawler(orekitData));
    // output file in user's home directory
    File workingDir = new File(System.getProperty("user.home"));
    File errorFile = new File(workingDir, "error.txt");
    System.out.println("Output file is in : " + errorFile.getAbsolutePath());
    PrintWriter PW = new PrintWriter(errorFile, "UTF-8");
    PW.printf("time \t\tCrossTrackErr \tLongTrackErr  \tRadialErr \tTotalErr%n");
    // setting the parameters of the simulation
    // Order of derivation of the DerivativeStructures
    int params = 3;
    int order = 3;
    DSFactory factory = new DSFactory(params, order);
    // number of samples of the montecarlo simulation
    int montecarlo_size = 100;
    // nominal values of the Orbital parameters
    double a_nominal = 7.278E6;
    double e_nominal = 1e-3;
    double i_nominal = FastMath.toRadians(98.3);
    double pa_nominal = FastMath.PI / 2;
    double raan_nominal = 0.0;
    double ni_nominal = 0.0;
    // mean of the gaussian curve for each of the errors around the nominal values
    // {a, i, RAAN}
    double[] mean = { 0, 0, 0 };
    // standard deviation of the gaussian curve for each of the errors around the nominal values
    // {dA, dI, dRaan}
    double[] dAdIdRaan = { 5, FastMath.toRadians(1e-3), FastMath.toRadians(1e-3) };
    // time of integration
    double final_Dt = 1 * 60 * 60;
    // number of steps per orbit
    double num_step_orbit = 10;
    DerivativeStructure a_0 = factory.variable(0, a_nominal);
    DerivativeStructure e_0 = factory.constant(e_nominal);
    DerivativeStructure i_0 = factory.variable(1, i_nominal);
    DerivativeStructure pa_0 = factory.constant(pa_nominal);
    DerivativeStructure raan_0 = factory.variable(2, raan_nominal);
    DerivativeStructure ni_0 = factory.constant(ni_nominal);
    // sometimes we will need the field of the DerivativeStructure to build new instances
    Field<DerivativeStructure> field = a_0.getField();
    // sometimes we will need the zero of the DerivativeStructure to build new instances
    DerivativeStructure zero = field.getZero();
    // initializing the FieldAbsoluteDate with only the field it will generate the day J2000
    FieldAbsoluteDate<DerivativeStructure> date_0 = new FieldAbsoluteDate<>(field);
    // initialize a basic frame
    Frame frame = FramesFactory.getEME2000();
    // initialize the orbit
    double mu = 3.9860047e14;
    FieldKeplerianOrbit<DerivativeStructure> KO = new FieldKeplerianOrbit<>(a_0, e_0, i_0, pa_0, raan_0, ni_0, PositionAngle.ECCENTRIC, frame, date_0, mu);
    // step of integration (how many times per orbit we take the mesures)
    double int_step = KO.getKeplerianPeriod().getReal() / num_step_orbit;
    // random generator to conduct an
    long number = 23091991;
    RandomGenerator RG = new Well19937a(number);
    GaussianRandomGenerator NGG = new GaussianRandomGenerator(RG);
    UncorrelatedRandomVectorGenerator URVG = new UncorrelatedRandomVectorGenerator(mean, dAdIdRaan, NGG);
    double[][] rand_gen = new double[montecarlo_size][3];
    for (int jj = 0; jj < montecarlo_size; jj++) {
        rand_gen[jj] = URVG.nextVector();
    }
    // 
    FieldSpacecraftState<DerivativeStructure> SS_0 = new FieldSpacecraftState<>(KO);
    // adding force models
    ForceModel fModel_Sun = new ThirdBodyAttraction(CelestialBodyFactory.getSun());
    ForceModel fModel_Moon = new ThirdBodyAttraction(CelestialBodyFactory.getMoon());
    ForceModel fModel_HFAM = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(18, 18));
    // setting an hipparchus field integrator
    OrbitType type = OrbitType.CARTESIAN;
    double[][] tolerance = NumericalPropagator.tolerances(0.001, KO.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<DerivativeStructure> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    // setting of the field propagator, we used the numerical one in order to add the third body attraction
    // and the holmes featherstone force models
    FieldNumericalPropagator<DerivativeStructure> numProp = new FieldNumericalPropagator<>(field, integrator);
    numProp.setOrbitType(type);
    numProp.setInitialState(SS_0);
    numProp.addForceModel(fModel_Sun);
    numProp.addForceModel(fModel_Moon);
    numProp.addForceModel(fModel_HFAM);
    // with the master mode we will calulcate and print the error on every fixed step on the file error.txt
    // we defined the StepHandler to do that giving him the random number generator,
    // the size of the montecarlo simulation and the initial date
    numProp.setMasterMode(zero.add(int_step), new MyStepHandler<DerivativeStructure>(rand_gen, montecarlo_size, date_0, PW));
    // 
    long START = System.nanoTime();
    FieldSpacecraftState<DerivativeStructure> finalState = numProp.propagate(date_0.shiftedBy(final_Dt));
    long STOP = System.nanoTime();
    System.out.println((STOP - START) / 1E6 + " ms");
    System.out.println(finalState.getDate());
    PW.close();
}
Also used : Frame(org.orekit.frames.Frame) GaussianRandomGenerator(org.hipparchus.random.GaussianRandomGenerator) ForceModel(org.orekit.forces.ForceModel) Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator) GaussianRandomGenerator(org.hipparchus.random.GaussianRandomGenerator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) DirectoryCrawler(org.orekit.data.DirectoryCrawler) PrintWriter(java.io.PrintWriter) DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) ThirdBodyAttraction(org.orekit.forces.gravity.ThirdBodyAttraction) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) DataProvidersManager(org.orekit.data.DataProvidersManager) UncorrelatedRandomVectorGenerator(org.hipparchus.random.UncorrelatedRandomVectorGenerator) OrbitType(org.orekit.orbits.OrbitType) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) File(java.io.File) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Aggregations

DataProvidersManager (org.orekit.data.DataProvidersManager)24 File (java.io.File)18 DirectoryCrawler (org.orekit.data.DirectoryCrawler)18 OrekitException (org.orekit.errors.OrekitException)17 AbsoluteDate (org.orekit.time.AbsoluteDate)12 IOException (java.io.IOException)9 Frame (org.orekit.frames.Frame)9 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)8 Orbit (org.orekit.orbits.Orbit)8 SpacecraftState (org.orekit.propagation.SpacecraftState)7 GeodeticPoint (org.orekit.bodies.GeodeticPoint)6 MarshallSolarActivityFutureEstimation (org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation)6 HolmesFeatherstoneAttractionModel (org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)6 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)6 URISyntaxException (java.net.URISyntaxException)5 ArrayList (java.util.ArrayList)5 TimeScale (org.orekit.time.TimeScale)5 ParseException (java.text.ParseException)4 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)4 ThirdBodyAttraction (org.orekit.forces.gravity.ThirdBodyAttraction)4