Commit 87e229e9 authored by Luc Maisonobe's avatar Luc Maisonobe

Merge branch 'master' into release-candidate

Conflicts:
	src/site/xdoc/changes.xml
parents ae04a4b8 5362669e
......@@ -79,10 +79,10 @@ class JPLCelestialBody implements CelestialBody {
* this frame <strong>must</strong> be aligned with ICRF
*/
JPLCelestialBody(final String name, final String supportedNames,
final JPLEphemeridesLoader.EphemerisType generateType,
final JPLEphemeridesLoader.RawPVProvider rawPVProvider,
final double gm, final double scale,
final IAUPole iauPole, final Frame definingFrameAlignedWithICRF) {
final JPLEphemeridesLoader.EphemerisType generateType,
final JPLEphemeridesLoader.RawPVProvider rawPVProvider,
final double gm, final double scale,
final IAUPole iauPole, final Frame definingFrameAlignedWithICRF) {
this.name = name;
this.gm = gm;
this.scale = scale;
......
......@@ -160,12 +160,8 @@ public class NetworkCrawler implements DataProvider {
return loaded;
} catch (URISyntaxException use) {
throw new OrekitException(use, new DummyLocalizable(use.getMessage()));
} catch (IOException ioe) {
throw new OrekitException(ioe, new DummyLocalizable(ioe.getMessage()));
} catch (ParseException pe) {
throw new OrekitException(pe, new DummyLocalizable(pe.getMessage()));
} catch (URISyntaxException | IOException | ParseException e) {
throw new OrekitException(e, new DummyLocalizable(e.getMessage()));
}
}
......
......@@ -23,7 +23,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.channels.UnsupportedAddressTypeException;
import java.text.ParseException;
import java.util.Iterator;
import java.util.NoSuchElementException;
......@@ -144,7 +143,7 @@ public class ZipJarCrawler implements DataProvider {
try {
// open the raw data stream
Archive archive = null;;
Archive archive = null;
try {
if (file != null) {
archive = new Archive(new FileInputStream(file));
......@@ -289,19 +288,9 @@ public class ZipJarCrawler implements DataProvider {
/** {@inheritDoc} */
@Override
public EntryStream next() throws NoSuchElementException {
if (next == null) {
throw new NoSuchElementException();
}
return next;
}
/** {@inheritDoc} */
@Override
public void remove() {
// this part is never called
throw new UnsupportedAddressTypeException();
}
};
}
......
......@@ -135,6 +135,26 @@ public class OrekitException extends Exception implements LocalizedException {
return parts.clone();
}
/** Recover a OrekitException, possibly embedded in a {@link MathRuntimeException}.
* <p>
* If the {@code MathRuntimeException} does not embed a OrekitException, a
* new one will be created.
* </p>
* @param exception MathRuntimeException to analyze
* @return a (possibly embedded) OrekitException
*/
public static OrekitException unwrap(final MathRuntimeException exception) {
for (Throwable t = exception; t != null; t = t.getCause()) {
if (t instanceof OrekitException) {
return (OrekitException) t;
}
}
return new OrekitException(exception);
}
/**
* Builds a message string by from a pattern and its arguments.
* @param locale Locale in which the message should be translated
......
......@@ -23,7 +23,9 @@ import org.hipparchus.exception.MathRuntimeException;
* during the propagation computation.
*
* @author Luc Maisonobe
* @deprecated as of 8.0 this class is not used anymore
*/
@Deprecated
public class PropagationException extends OrekitException {
/** Serializable UID. */
......
......@@ -65,13 +65,13 @@ public class TimeStampedCacheException extends OrekitException {
super(exception);
}
/** Recover a PropagationException, possibly embedded in a {@link OrekitException}.
/** Recover a TimeStampedCacheException, possibly embedded in a {@link OrekitException}.
* <p>
* If the {@code OrekitException} does not embed a PropagationException, a
* If the {@code OrekitException} does not embed a TimeStampedCacheException, a
* new one will be created.
* </p>
* @param oe OrekitException to analyze
* @return a (possibly embedded) PropagationException
* @return a (possibly embedded) TimeStampedCacheException
*/
public static TimeStampedCacheException unwrap(final OrekitException oe) {
......
......@@ -44,8 +44,10 @@ public class IodGooding {
/** Normalizing constant for distances. */
private double R;
/** Normalizing constant for velocities. */
private double V;
/** Normalizing constant for duration. */
private double T;
......@@ -144,17 +146,16 @@ public class IodGooding {
final Vector3D lineOfSight1, final AbsoluteDate dateObs1,
final Vector3D lineOfSight2, final AbsoluteDate dateObs2,
final Vector3D lineOfSight3, final AbsoluteDate dateObs3,
final double rho1init, final double rho3init)
{
final double rho1init, final double rho3init) {
this.date1 = dateObs1;
// normalizeing coefficients
// normalizing coefficients
R = FastMath.max(rho1init, rho3init);
V = FastMath.sqrt(mu / R);
T = R / V;
// Initialize Lambert's problem solver for nondimensional units.
// Initialize Lambert's problem solver for non-dimensional units.
lambert = new IodLambert(1.);
this.vObserverPosition1 = O1.scalarMultiply(1. / R);
......@@ -489,8 +490,7 @@ public class IodGooding {
private Vector3D getPositionOnLoS2(final Vector3D E1, final double RO1,
final Vector3D E3, final double RO3,
final double T13, final double T12,
final double nRev, final boolean posigrade)
{
final double nRev, final boolean posigrade) {
final Vector3D P1 = vObserverPosition1.add(E1.scalarMultiply(RO1));
R1 = P1.getNorm();
......
......@@ -144,6 +144,19 @@ public class ConstantThrustManeuver extends AbstractForceModel {
}
@Override
public void init(final SpacecraftState s0, final AbsoluteDate t) {
// set the initial value of firing
final AbsoluteDate sDate = s0.getDate();
final boolean isForward = sDate.compareTo(t) < 0;
final boolean isBetween =
startDate.compareTo(sDate) < 0 && endDate.compareTo(sDate) > 0;
final boolean isOnStart = startDate.compareTo(sDate) == 0;
final boolean isOnEnd = endDate.compareTo(sDate) == 0;
firing = isBetween || (isForward && isOnStart) || (!isForward && isOnEnd);
}
/** Get the thrust.
* @return thrust force (N).
*/
......
......@@ -28,7 +28,6 @@ import org.orekit.bodies.GeodeticPoint;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.errors.PropagationException;
import org.orekit.orbits.Orbit;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.analytical.KeplerianPropagator;
......@@ -134,32 +133,23 @@ public class AlongTrackAiming implements TileAiming {
final boolean isAscending)
throws OrekitException {
try {
// find the span of the next half track
final Propagator propagator = new KeplerianPropagator(orbit);
final HalfTrackSpanHandler handler = new HalfTrackSpanHandler(isAscending);
final LatitudeExtremumDetector detector =
new LatitudeExtremumDetector(0.25 * orbit.getKeplerianPeriod(), 1.0e-3, ellipsoid).
withHandler(handler).
withMaxIter(100);
propagator.addEventDetector(detector);
propagator.propagate(orbit.getDate().shiftedBy(3 * orbit.getKeplerianPeriod()));
// sample the half track
propagator.clearEventsDetectors();
final HalfTrackSampler sampler = new HalfTrackSampler(ellipsoid);
propagator.setMasterMode(handler.getEnd().durationFrom(handler.getStart()) / SAMPLING_STEPS, sampler);
propagator.propagate(handler.getStart(), handler.getEnd());
return sampler.getHalfTrack();
} catch (PropagationException pe) {
if (pe.getCause() instanceof OrekitException) {
throw (OrekitException) pe.getCause();
} else {
throw pe;
}
}
// find the span of the next half track
final Propagator propagator = new KeplerianPropagator(orbit);
final HalfTrackSpanHandler handler = new HalfTrackSpanHandler(isAscending);
final LatitudeExtremumDetector detector =
new LatitudeExtremumDetector(0.25 * orbit.getKeplerianPeriod(), 1.0e-3, ellipsoid).
withHandler(handler).
withMaxIter(100);
propagator.addEventDetector(detector);
propagator.propagate(orbit.getDate().shiftedBy(3 * orbit.getKeplerianPeriod()));
// sample the half track
propagator.clearEventsDetectors();
final HalfTrackSampler sampler = new HalfTrackSampler(ellipsoid);
propagator.setMasterMode(handler.getEnd().durationFrom(handler.getStart()) / SAMPLING_STEPS, sampler);
propagator.propagate(handler.getStart(), handler.getEnd());
return sampler.getHalfTrack();
}
......
......@@ -23,7 +23,6 @@ import org.hipparchus.util.Pair;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.errors.OrekitException;
import org.orekit.errors.PropagationException;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.sampling.OrekitFixedStepHandler;
import org.orekit.time.AbsoluteDate;
......@@ -65,22 +64,18 @@ class HalfTrackSampler implements OrekitFixedStepHandler {
/** {@inheritDoc} */
@Override
public void handleStep(final SpacecraftState currentState, final boolean isLast)
throws PropagationException {
try {
throws OrekitException {
// find the sliding ground point below spacecraft
final TimeStampedPVCoordinates pv = currentState.getPVCoordinates(ellipsoid.getBodyFrame());
final TimeStampedPVCoordinates groundPV = ellipsoid.projectToGround(pv, ellipsoid.getBodyFrame());
// find the sliding ground point below spacecraft
final TimeStampedPVCoordinates pv = currentState.getPVCoordinates(ellipsoid.getBodyFrame());
final TimeStampedPVCoordinates groundPV = ellipsoid.projectToGround(pv, ellipsoid.getBodyFrame());
// geodetic coordinates
final GeodeticPoint gp =
ellipsoid.transform(groundPV.getPosition(), ellipsoid.getBodyFrame(), currentState.getDate());
// geodetic coordinates
final GeodeticPoint gp =
ellipsoid.transform(groundPV.getPosition(), ellipsoid.getBodyFrame(), currentState.getDate());
halfTrack.add(new Pair<GeodeticPoint, TimeStampedPVCoordinates>(gp, groundPV));
halfTrack.add(new Pair<GeodeticPoint, TimeStampedPVCoordinates>(gp, groundPV));
} catch (OrekitException oe) {
throw new PropagationException(oe);
}
}
}
......@@ -25,7 +25,6 @@ import java.util.Map;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.errors.PropagationException;
import org.orekit.frames.Frame;
import org.orekit.propagation.events.EventDetector;
import org.orekit.propagation.sampling.OrekitFixedStepHandler;
......@@ -99,7 +98,7 @@ public abstract class AbstractPropagator implements Propagator {
}
/** {@inheritDoc} */
public SpacecraftState getInitialState() throws PropagationException {
public SpacecraftState getInitialState() throws OrekitException {
return initialState;
}
......@@ -114,7 +113,7 @@ public abstract class AbstractPropagator implements Propagator {
}
/** {@inheritDoc} */
public void resetInitialState(final SpacecraftState state) throws PropagationException {
public void resetInitialState(final SpacecraftState state) throws OrekitException {
initialState = state;
setStartDate(state.getDate());
}
......@@ -179,11 +178,11 @@ public abstract class AbstractPropagator implements Propagator {
/** Update state by adding all additional states.
* @param original original state
* @return updated state, with all additional states included
* @exception PropagationException if one of the providers throws one
* @exception OrekitException if one of the providers throws one
* @see #addAdditionalStateProvider(AdditionalStateProvider)
*/
protected SpacecraftState updateAdditionalStates(final SpacecraftState original)
throws PropagationException {
throws OrekitException {
// start with original state,
// which may already contain additional states, for example in interpolated ephemerides
......@@ -258,7 +257,7 @@ public abstract class AbstractPropagator implements Propagator {
public abstract void clearEventsDetectors();
/** {@inheritDoc} */
public SpacecraftState propagate(final AbsoluteDate target) throws PropagationException {
public SpacecraftState propagate(final AbsoluteDate target) throws OrekitException {
if (startDate == null) {
startDate = getInitialState().getDate();
}
......
......@@ -16,7 +16,7 @@
*/
package org.orekit.propagation;
import org.orekit.errors.PropagationException;
import org.orekit.errors.OrekitException;
/** This interface represents providers for additional state data beyond {@link SpacecraftState}.
* <p>
......@@ -39,8 +39,8 @@ public interface AdditionalStateProvider {
/** Get the additional state.
* @param state spacecraft state to which additional state should correspond
* @return additional state corresponding to spacecraft state
* @exception PropagationException if additional state cannot be computed
* @exception OrekitException if additional state cannot be computed
*/
double[] getAdditionalState(SpacecraftState state) throws PropagationException;
double[] getAdditionalState(SpacecraftState state) throws OrekitException;
}
......@@ -22,7 +22,6 @@ import java.util.List;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.attitudes.InertialProvider;
import org.orekit.errors.OrekitException;
import org.orekit.errors.PropagationException;
import org.orekit.frames.Frame;
import org.orekit.propagation.events.EventDetector;
import org.orekit.propagation.sampling.OrekitFixedStepHandler;
......@@ -164,16 +163,16 @@ public interface Propagator extends PVCoordinatesProvider {
/** Get the propagator initial state.
* @return initial state
* @exception PropagationException if state cannot be retrieved
* @exception OrekitException if state cannot be retrieved
*/
SpacecraftState getInitialState() throws PropagationException;
SpacecraftState getInitialState() throws OrekitException;
/** Reset the propagator initial state.
* @param state new initial state to consider
* @exception PropagationException if initial state cannot be reset
* @exception OrekitException if initial state cannot be reset
*/
void resetInitialState(final SpacecraftState state)
throws PropagationException;
throws OrekitException;
/** Add a set of user-specified state parameters to be computed along with the orbit propagation.
* @param additionalStateProvider provider for additional state
......@@ -268,9 +267,9 @@ public interface Propagator extends PVCoordinatesProvider {
* target date is only a hint, not a mandatory objective.</p>
* @param target target date towards which orbit state should be propagated
* @return propagated state
* @exception PropagationException if state cannot be propagated
* @exception OrekitException if state cannot be propagated
*/
SpacecraftState propagate(AbsoluteDate target) throws PropagationException;
SpacecraftState propagate(AbsoluteDate target) throws OrekitException;
/** Propagate from a start date towards a target date.
* <p>Those propagators use a start date and a target date to
......@@ -281,8 +280,8 @@ public interface Propagator extends PVCoordinatesProvider {
* @param start start date from which orbit state should be propagated
* @param target target date to which orbit state should be propagated
* @return propagated state
* @exception PropagationException if state cannot be propagated
* @exception OrekitException if state cannot be propagated
*/
SpacecraftState propagate(AbsoluteDate start, AbsoluteDate target) throws PropagationException;
SpacecraftState propagate(AbsoluteDate start, AbsoluteDate target) throws OrekitException;
}
......@@ -32,7 +32,6 @@ import org.orekit.attitudes.Attitude;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitInternalError;
import org.orekit.errors.PropagationException;
import org.orekit.frames.Frame;
import org.orekit.orbits.Orbit;
import org.orekit.propagation.AbstractPropagator;
......@@ -117,7 +116,7 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
/** {@inheritDoc} */
public SpacecraftState propagate(final AbsoluteDate start, final AbsoluteDate target)
throws PropagationException {
throws OrekitException {
try {
lastPropagationStart = start;
......@@ -174,12 +173,8 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
setStartDate(state.getDate());
return state;
} catch (PropagationException pe) {
throw pe;
} catch (OrekitException oe) {
throw PropagationException.unwrap(oe);
} catch (MathRuntimeException mrte) {
throw PropagationException.unwrap(mrte);
throw OrekitException.unwrap(mrte);
}
}
......@@ -332,10 +327,10 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
/** Get the mass.
* @param date target date for the orbit
* @return mass mass
* @exception PropagationException if some parameters are out of bounds
* @exception OrekitException if some parameters are out of bounds
*/
protected abstract double getMass(final AbsoluteDate date)
throws PropagationException;
throws OrekitException;
/** Get PV coordinates provider.
* @return PV coordinates provider
......@@ -348,18 +343,18 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
* @param state new intermediate state to consider
* @param forward if true, the intermediate state is valid for
* propagations after itself
* @exception PropagationException if initial state cannot be reset
* @exception OrekitException if initial state cannot be reset
*/
protected abstract void resetIntermediateState(final SpacecraftState state, final boolean forward)
throws PropagationException;
throws OrekitException;
/** Extrapolate an orbit up to a specific target date.
* @param date target date for the orbit
* @return extrapolated parameters
* @exception PropagationException if some parameters are out of bounds
* @exception OrekitException if some parameters are out of bounds
*/
protected abstract Orbit propagateOrbit(final AbsoluteDate date)
throws PropagationException;
throws OrekitException;
/** Propagate an orbit without any fancy features.
* <p>This method is similar in spirit to the {@link #propagate} method,
......@@ -368,9 +363,9 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
* stop exactly at the specified date.</p>
* @param date target date for propagation
* @return state at specified date
* @exception PropagationException if propagation cannot reach specified date
* @exception OrekitException if propagation cannot reach specified date
*/
protected SpacecraftState basicPropagate(final AbsoluteDate date) throws PropagationException {
protected SpacecraftState basicPropagate(final AbsoluteDate date) throws OrekitException {
try {
// evaluate orbit
......@@ -384,7 +379,7 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
return new SpacecraftState(orbit, attitude, getMass(date));
} catch (OrekitException oe) {
throw new PropagationException(oe);
throw new OrekitException(oe);
}
}
......@@ -452,12 +447,12 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
/** {@inheritDoc} */
protected Orbit propagateOrbit(final AbsoluteDate target)
throws PropagationException {
throws OrekitException {
return AbstractAnalyticalPropagator.this.propagateOrbit(target);
}
/** {@inheritDoc} */
public double getMass(final AbsoluteDate date) throws PropagationException {
public double getMass(final AbsoluteDate date) throws OrekitException {
return AbstractAnalyticalPropagator.this.getMass(date);
}
......@@ -468,18 +463,18 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
}
/** {@inheritDoc} */
public void resetInitialState(final SpacecraftState state) throws PropagationException {
public void resetInitialState(final SpacecraftState state) throws OrekitException {
AbstractAnalyticalPropagator.this.resetInitialState(state);
}
/** {@inheritDoc} */
protected void resetIntermediateState(final SpacecraftState state, final boolean forward)
throws PropagationException {
throws OrekitException {
AbstractAnalyticalPropagator.this.resetIntermediateState(state, forward);
}
/** {@inheritDoc} */
public SpacecraftState getInitialState() throws PropagationException {
public SpacecraftState getInitialState() throws OrekitException {
return AbstractAnalyticalPropagator.this.getInitialState();
}
......@@ -586,7 +581,7 @@ public abstract class AbstractAnalyticalPropagator extends AbstractPropagator {
/** {@inheritDoc} */
public SpacecraftState getInterpolatedState(final AbsoluteDate date)
throws PropagationException {
throws OrekitException {
// compute the basic spacecraft state
final SpacecraftState basicState = basicPropagate(date);
......
......@@ -24,7 +24,6 @@ import java.util.Map;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitExceptionWrapper;
import org.orekit.errors.OrekitMessages;
import org.orekit.errors.PropagationException;
import org.orekit.orbits.Orbit;
import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
......@@ -111,30 +110,30 @@ public class AdapterPropagator extends AbstractAnalyticalPropagator {
}
/** {@inheritDoc} */
public SpacecraftState getInitialState() throws PropagationException {
public SpacecraftState getInitialState() throws OrekitException {
return reference.getInitialState();
}
/** {@inheritDoc} */
@Override
public void resetInitialState(final SpacecraftState state)
throws PropagationException {
throws OrekitException {
reference.resetInitialState(state);
}
/** {@inheritDoc} */
protected void resetIntermediateState(final SpacecraftState state, final boolean forward)
throws PropagationException {
throws OrekitException {
if (reference instanceof AbstractAnalyticalPropagator) {
((AbstractAnalyticalPropagator) reference).resetIntermediateState(state, forward);
} else {
throw new PropagationException(OrekitMessages.NON_RESETABLE_STATE);
throw new OrekitException(OrekitMessages.NON_RESETABLE_STATE);
}
}
/** {@inheritDoc} */
@Override
protected SpacecraftState basicPropagate(final AbsoluteDate date) throws PropagationException {
protected SpacecraftState basicPropagate(final AbsoluteDate date) throws OrekitException {
try {
// compute reference state
......@@ -156,30 +155,20 @@ public class AdapterPropagator extends AbstractAnalyticalPropagator {
return state;
} catch (OrekitExceptionWrapper oew) {
if (oew.getException() instanceof PropagationException) {
throw (PropagationException) oew.getException();
} else {
throw new PropagationException(oew.getException());
}
} catch (OrekitException oe) {
if (oe instanceof PropagationException) {
throw (PropagationException) oe;
} else {
throw new PropagationException(oe);
}
throw new OrekitException(oew.getException());
}
}
/** {@inheritDoc} */
protected Orbit propagateOrbit(final AbsoluteDate date)
throws PropagationException {
throws OrekitException {
return basicPropagate(date).getOrbit();
}
/** {@inheritDoc}*/
protected double getMass(final AbsoluteDate date)
throws PropagationException {
throws OrekitException {
return basicPropagate(date).getMass();
}
......
......@@ -28,7 +28,6 @@ import org.orekit.attitudes.AttitudeProvider;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitInternalError;
import org.orekit.errors.OrekitMessages;
import org.orekit.errors.PropagationException;
import org.orekit.frames.Frame;
import org.orekit.orbits.Orbit;
import org.orekit.propagation.BoundedPropagator;
......@@ -129,34 +128,29 @@ public class Ephemeris extends AbstractAnalyticalPropagator implements BoundedPr
@Override
/** {@inheritDoc} */
public SpacecraftState basicPropagate(final AbsoluteDate date) throws PropagationException {
try {
final List<SpacecraftState> neighbors = cache.getNeighbors(date);
final SpacecraftState interpolatedState = neighbors.get(0).interpolate(date, neighbors);
public SpacecraftState basicPropagate(final AbsoluteDate date) throws OrekitException {
final List<SpacecraftState> neighbors = cache.getNeighbors(date);
final SpacecraftState interpolatedState = neighbors.get(0).interpolate(date, neighbors);
final AttitudeProvider attitudeProvider = this.getAttitudeProvider();
final AttitudeProvider attitudeProvider = this.getAttitudeProvider();
if (attitudeProvider == null) {
return interpolatedState;
}
else {
pvProvider.setCurrentState(interpolatedState);
final Attitude calculatedAttitude = attitudeProvider.getAttitude(pvProvider, date, interpolatedState.getFrame());
return new SpacecraftState(interpolatedState.getOrbit(), calculatedAttitude, interpolatedState.getMass());
}
} catch (OrekitException tce) {
throw new PropagationException(tce);
if (attitudeProvider == null) {
return interpolatedState;
}
else {
pvProvider.setCurrentState(interpolatedState);
final Attitude calculatedAttitude = attitudeProvider.getAttitude(pvProvider, date, interpolatedState.getFrame());
return new SpacecraftState(interpolatedState.getOrbit(), calculatedAttitude, interpolatedState.getMass());
}
}
/** {@inheritDoc} */