Skip to content
Snippets Groups Projects
Commit 51b7c3b0 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Prepared framework for more complete flight dynamics tests.

parent 1db62b01
No related branches found
No related tags found
No related merge requests found
...@@ -184,15 +184,18 @@ public class RuggedImpl implements Rugged { ...@@ -184,15 +184,18 @@ public class RuggedImpl implements Rugged {
} }
/** Select time scale Orekit data. /** Select time scale Orekit data.
* @param orekitDataDir top directory for Orekit data * @param orekitDataDir top directory for Orekit data (if null, Orekit has already been configured)
* @return utc time scale * @return utc time scale
* @exception OrekitException if data needed for some frame cannot be loaded * @exception OrekitException if data needed for some frame cannot be loaded
*/ */
private TimeScale selectTimeScale(final File orekitDataDir) private TimeScale selectTimeScale(final File orekitDataDir)
throws OrekitException { throws OrekitException {
// set up Orekit data if (orekitDataDir != null) {
DataProvidersManager.getInstance().addProvider(new DirectoryCrawler(orekitDataDir)); // set up Orekit data
DataProvidersManager.getInstance().addProvider(new DirectoryCrawler(orekitDataDir));
}
return TimeScalesFactory.getUTC(); return TimeScalesFactory.getUTC();
} }
......
/* Copyright 2002-2014 CS Systèmes d'Information
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.orekit.rugged.core;
import java.io.File;
import java.net.URISyntaxException;
import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator;
import org.apache.commons.math3.util.FastMath;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.attitudes.NadirPointing;
import org.orekit.bodies.BodyShape;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.data.DataProvidersManager;
import org.orekit.data.DirectoryCrawler;
import org.orekit.errors.OrekitException;
import org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel;
import org.orekit.forces.gravity.ThirdBodyAttraction;
import org.orekit.forces.gravity.potential.GravityFieldFactory;
import org.orekit.forces.gravity.potential.ICGEMFormatReader;
import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.orbits.CircularOrbit;
import org.orekit.orbits.OrbitType;
import org.orekit.orbits.PositionAngle;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.rugged.api.Rugged;
import org.orekit.rugged.api.RuggedException;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
public class RuggedImplTest {
@Test
public void testSetContext() throws RuggedException, OrekitException {
RuggedImpl rugged = new RuggedImpl();
rugged.setGeneralContext(null,
propagator.getInitialState().getDate(),
Rugged.Algorithm.DUVENHAGE,
Rugged.Ellipsoid.WGS84,
Rugged.InertialFrame.EME2000,
Rugged.BodyRotatingFrame.ITRF,
propagator);
}
@Before
public void setUp() throws RuggedException, OrekitException, URISyntaxException {
String path = getClass().getClassLoader().getResource("orekit-data").toURI().getPath();
DataProvidersManager.getInstance().addProvider(new DirectoryCrawler(new File(path)));
// the following orbital parameters have been computed using
// Orekit tutorial about phasing, using the following configuration:
//
// orbit.date = 2012-01-01T00:00:00.000
// phasing.orbits.number = 143
// phasing.days.number = 10
// sun.synchronous.reference.latitude = 0
// sun.synchronous.reference.ascending = false
// sun.synchronous.mean.solar.time = 10:30:00
// gravity.field.degree = 12
// gravity.field.order = 12
AbsoluteDate date = new AbsoluteDate("2012-01-01T00:00:00.000", TimeScalesFactory.getUTC());
NormalizedSphericalHarmonicsProvider gravityField = GravityFieldFactory.getNormalizedProvider(12, 12);
Frame eme2000 = FramesFactory.getEME2000();
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
CircularOrbit orbit = new CircularOrbit(7173352.811913891,
-4.029194321683225E-4, 0.0013530362644647786,
FastMath.toRadians(98.63218182243709),
FastMath.toRadians(77.55565567747836),
FastMath.PI, PositionAngle.TRUE,
eme2000, date, gravityField.getMu());
BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
itrf);
AttitudeProvider provider = new NadirPointing(earth);
SpacecraftState state = new SpacecraftState(orbit, provider.getAttitude(orbit, date, orbit.getFrame()), 1180.0);
// numerical model for improving orbit
OrbitType type = OrbitType.CIRCULAR;
double[][] tolerances = NumericalPropagator.tolerances(0.1, orbit, type);
DormandPrince853Integrator integrator =
new DormandPrince853Integrator(1.0e-4 * orbit.getKeplerianPeriod(),
1.0e-1 * orbit.getKeplerianPeriod(),
tolerances[0], tolerances[1]);
integrator.setInitialStepSize(1.0e-2 * orbit.getKeplerianPeriod());
NumericalPropagator numericalPropagator = new NumericalPropagator(integrator);
numericalPropagator.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, gravityField));
numericalPropagator.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getSun()));
numericalPropagator.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getMoon()));
numericalPropagator.setOrbitType(type);
numericalPropagator.setInitialState(state);
propagator = numericalPropagator;
}
Propagator propagator;
}
This diff is collapsed.
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment