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

Merge branch 'master' of ssh://git@www.orekit.org/orekit.git

parents 8ced3522 92ec0db3
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,6 @@ import java.io.Serializable;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.errors.OrekitException;
import org.orekit.errors.TimeStampedCacheException;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeFunction;
import org.orekit.utils.IERSConventions;
......@@ -68,26 +67,6 @@ class TODProvider implements TransformProvider {
return eopHistory;
}
/** Get the LoD (Length of Day) value.
* <p>The data provided comes from the IERS files. It is smoothed data.</p>
* @param date date at which the value is desired
* @return LoD in seconds (0 if date is outside covered range)
* @exception TimeStampedCacheException if EOP data cannot be retrieved
*/
double getLOD(final AbsoluteDate date) throws TimeStampedCacheException {
return (eopHistory == null) ? 0.0 : eopHistory.getLOD(date);
}
/** Get the pole IERS Reference Pole correction.
* <p>The data provided comes from the IERS files. It is smoothed data.</p>
* @param date date at which the correction is desired
* @return pole correction ({@link PoleCorrection#NULL_CORRECTION
* PoleCorrection.NULL_CORRECTION} if date is outside covered range)
*/
public PoleCorrection getPoleCorrection(final AbsoluteDate date) {
return (eopHistory == null) ? PoleCorrection.NULL_CORRECTION : eopHistory.getPoleCorrection(date);
}
/** Get the transform from Mean Of Date at specified date.
* <p>The update considers the nutation effects from IERS data.</p>
* @param date new value of the date
......
......@@ -341,7 +341,7 @@ public class PartialDerivativesEquations implements AdditionalEquations {
new DerivativeStructure(nbVars, 1, 2, position.getZ()));
// velocity corresponds three free parameters
final Vector3D velocity = s.getPVCoordinates().getPosition();
final Vector3D velocity = s.getPVCoordinates().getVelocity();
final FieldVector3D<DerivativeStructure> dsV = new FieldVector3D<DerivativeStructure>(new DerivativeStructure(nbVars, 1, 3, velocity.getX()),
new DerivativeStructure(nbVars, 1, 4, velocity.getY()),
new DerivativeStructure(nbVars, 1, 5, velocity.getZ()));
......
package org.orekit.propagation.numerical;
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math3.geometry.euclidean.threed.FieldRotation;
import org.apache.commons.math3.geometry.euclidean.threed.FieldVector3D;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.ode.UnknownParameterException;
import org.apache.commons.math3.ode.nonstiff.DormandPrince54Integrator;
import org.junit.Before;
import org.junit.Test;
import org.orekit.errors.OrekitException;
import org.orekit.forces.ForceModel;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.orbits.CartesianOrbit;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.events.EventDetector;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.Constants;
import org.orekit.utils.PVCoordinates;
import java.util.Collection;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/** Unit tests for {@link PartialDerivativesEquations}. */
public class PartialDerivativesEquationsTest {
/** arbitrary date */
private static final AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
/** Earth gravitational parameter */
private static final double gm = Constants.EIGEN5C_EARTH_MU;
/** arbitrary inertial frame */
private static final Frame eci = FramesFactory.getGCRF();
/** unused propagator */
private NumericalPropagator propagator;
/** mock force model */
private MockForceModel forceModel;
/** arbitrary PV */
private PVCoordinates pv;
/** arbitrary state */
private SpacecraftState state;
/** subject under test */
private PartialDerivativesEquations pde;
/**
* set up {@link #pde} and dependencies.
*
* @throws OrekitException on error
*/
@Before
public void setUp() throws OrekitException {
propagator = new NumericalPropagator(new DormandPrince54Integrator(1, 500, 0.001, 0.001));
forceModel = new MockForceModel();
propagator.addForceModel(forceModel);
pde = new PartialDerivativesEquations("pde", propagator);
Vector3D p = new Vector3D(7378137, 0, 0);
Vector3D v = new Vector3D(0, 7500, 0);
pv = new PVCoordinates(p, v);
state = new SpacecraftState(new CartesianOrbit(pv, eci, date, gm))
.addAdditionalState("pde", new double[2 * 3 * 6]);
pde.setInitialJacobians(state, 6, 0);
}
/**
* check {@link PartialDerivativesEquations#computeDerivatives(SpacecraftState,
* double[])} correctly sets the satellite velocity.
*
* @throws OrekitException on error
*/
@Test
public void testComputeDerivativesStateVelocity() throws OrekitException {
//setup
double[] pdot = new double[36];
//action
pde.computeDerivatives(state, pdot);
//verify
assertThat(forceModel.accelerationDerivativesPosition.toVector3D(), is(pv.getPosition()));
assertThat(forceModel.accelerationDerivativesVelocity.toVector3D(), is(pv.getVelocity()));
}
/** Mock {@link ForceModel}. */
private static class MockForceModel implements ForceModel {
/**
* argument for {@link #accelerationDerivatives(AbsoluteDate, Frame,
* FieldVector3D, FieldVector3D, FieldRotation, DerivativeStructure)}.
*/
public FieldVector3D<DerivativeStructure> accelerationDerivativesPosition;
/**
* argument for {@link #accelerationDerivatives(AbsoluteDate, Frame,
* FieldVector3D, FieldVector3D, FieldRotation, DerivativeStructure)}.
*/
public FieldVector3D<DerivativeStructure> accelerationDerivativesVelocity;
@Override
public void addContribution(SpacecraftState s, TimeDerivativesEquations adder) throws OrekitException {
}
@Override
public FieldVector3D<DerivativeStructure> accelerationDerivatives(AbsoluteDate date, Frame frame, FieldVector3D<DerivativeStructure> position, FieldVector3D<DerivativeStructure> velocity, FieldRotation<DerivativeStructure> rotation, DerivativeStructure mass) throws OrekitException {
this.accelerationDerivativesPosition = position;
this.accelerationDerivativesVelocity = velocity;
return position;
}
@Override
public FieldVector3D<DerivativeStructure> accelerationDerivatives(SpacecraftState s, String paramName) throws OrekitException {
return null;
}
@Override
public EventDetector[] getEventsDetectors() {
return new EventDetector[0];
}
@Override
public double getParameter(String name) throws UnknownParameterException {
return 0;
}
@Override
public void setParameter(String name, double value) throws UnknownParameterException {
}
@Override
public Collection<String> getParametersNames() {
return null;
}
@Override
public boolean isSupported(String name) {
return false;
}
}
}
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