Commit d5a7babd authored by Luc Maisonobe's avatar Luc Maisonobe

Revert "Improved consistency between eccentricity improvement and other improvements."

This reverts commit 02cbcac8.
parent 3d313a78
......@@ -217,8 +217,17 @@ public class Phasing {
final CircularOrbit tmp1 = improveEarthPhasing(previous, nbOrbits, nbDays, propagator);
final CircularOrbit tmp2 = improveSunSynchronization(tmp1, nbOrbits * tmp1.getKeplerianPeriod(),
latitude, ascending, mst, propagator);
orbit = improveFrozenEccentricity(tmp2, propagator, nbDays, nbOrbits);
latitude, ascending, mst, propagator);
FittedEccentricity fittedEccentricity = fitEccentricity(tmp2, propagator, nbDays, nbOrbits);
// collapse mean evolution circular motion to its center point
orbit = new CircularOrbit(tmp2.getA(),
tmp2.getCircularEx() - fittedEccentricity.dx0,
tmp2.getCircularEy() - fittedEccentricity.dy0,
tmp2.getI(), tmp2.getRightAscensionOfAscendingNode(),
tmp2.getAlphaV(), PositionAngle.TRUE,
tmp2.getFrame(), previous.getDate(),
tmp2.getMu());
final double da = orbit.getA() - previous.getA();
final double dex = orbit.getCircularEx() - previous.getCircularEx();
......@@ -246,8 +255,7 @@ public class Phasing {
FastMath.toDegrees(orbit.getI()),
FastMath.toDegrees(orbit.getRightAscensionOfAscendingNode()));
System.out.format(Locale.US, "%nfinal frozen eccentricity%n");
final FittedEccentricity fittedEccentricity = new FittedEccentricity(orbit, nbDays, nbOrbits);
fittedEccentricity.fit(propagator);
final FittedEccentricity fittedEccentricity = fitEccentricity(orbit, propagator, nbDays, nbOrbits);
System.out.format(Locale.US, " ex_f = %17.10e, ey_f = %17.10e%n",
fittedEccentricity.cx, fittedEccentricity.cy);
......@@ -268,17 +276,14 @@ public class Phasing {
*/
private class FittedEccentricity {
/** Initial orbit. */
private final CircularOrbit initial;
/** Cycle end date. */
private final AbsoluteDate tEnd;
/** Observation points for the fitting. */
private final List<Observation> observed;
/** Frozen eccentricity pulsation. */
private final double eta;
/** Sampled points. */
private final List<Observation> observed;
/** Model reference date. */
private AbsoluteDate tR;
/** Center X component of the mean eccentricity. */
private double cx;
......@@ -293,42 +298,41 @@ public class Phasing {
private double dy0;
/** Simple constructor.
* @param initial orbit at start time
* @param tR model reference date
* @param inclination orbit inclination
* @param nbDays number of days of the phasing cycle
* @param nbOrbits number of orbits of the phasing cycle
*/
public FittedEccentricity(final CircularOrbit initial,
public FittedEccentricity(final AbsoluteDate tR, final double inclination,
final int nbDays, final int nbOrbits) {
// extract gravity field data
final double referenceRadius = gravityField.getAe();
final double mu = gravityField.getMu();
final double[][] unnormalization = GravityFieldFactory.getUnnormalizationFactors(3, 0);
final double j2 = -unnormalization[2][0] * gravityField.onDate(initial.getDate()).getNormalizedCnm(2, 0);
final double j2 = -unnormalization[2][0] * gravityField.onDate(tR).getNormalizedCnm(2, 0);
final double period = nbDays * Constants.JULIAN_DAY / nbOrbits;
final double meanMotion = 2 * FastMath.PI / period;
final double sinI = FastMath.sin(initial.getI());
final double sinI = FastMath.sin(inclination);
final double a = FastMath.cbrt(mu / (meanMotion * meanMotion));
final double rOa = referenceRadius / a;
this.eta = 3 * meanMotion * j2 * rOa * rOa * (1.25 * sinI * sinI - 1.0);
this.initial = initial;
this.tEnd = initial.getDate().shiftedBy(nbDays * Constants.JULIAN_DAY);
this.tR = tR;
this.observed = new ArrayList<>();
}
/** Perform fitting.
* @param propagator propagator to use
/** Add a sampled orbit data.
* @param orbit orbit at sampling date
*/
public void fit(final Propagator propagator) {
public void addSamplingPoint(final Orbit orbit) {
final CircularOrbit circular = (CircularOrbit) OrbitType.CIRCULAR.convertType(orbit);
observed.add(new Observation(circular, tR));
}
propagator.resetInitialState(new SpacecraftState(initial));
final AbsoluteDate start = initial.getDate();
// sample orbit for one phasing cycle
propagator.setMasterMode(60, (state, isLast) -> observed.add(new Observation(state)));
propagator.propagate(start, tEnd);
/** Perform fitting.
*/
public void fit() {
final LeastSquaresProblem lsp = new LeastSquaresBuilder().
maxEvaluations(1000).
......@@ -348,14 +352,6 @@ public class Phasing {
}
double[] mean(final AbsoluteDate t) {
final SinCos sc = FastMath.sinCos(eta * t.durationFrom(initial.getDate()));
return new double[] {
cx + dx0 * sc.cos() + dy0 * sc.sin(),
cy - dx0 * sc.sin() + dy0 * sc.cos()
};
}
/** Value of the error model.
* @param params fitting parameters
* @return model value
......@@ -409,11 +405,11 @@ public class Phasing {
private double ey;
/** Simple constructor.
* @param state spacecraft state at observation time
* @param orbit orbit at observation time
* @param reference reference time
*/
Observation(final SpacecraftState state) {
final CircularOrbit orbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(state.getOrbit());
this.dt = orbit.getDate().durationFrom(initial.getDate());
Observation(final CircularOrbit orbit, final AbsoluteDate reference) {
this.dt = orbit.getDate().durationFrom(reference);
this.alphaM = orbit.getAlphaM();
this.ex = orbit.getCircularEx();
this.ey = orbit.getCircularEy();
......@@ -614,24 +610,21 @@ public class Phasing {
* @param propagator propagator to use
* @param nbDays number of days of the phasing cycle
* @param nbOrbits number of orbits of the phasing cycle
* @return orit with improved frozen eccentricity
* @return fitted eccentricity
*/
private CircularOrbit improveFrozenEccentricity(final CircularOrbit previous, final Propagator propagator,
final int nbDays, final int nbOrbits) {
private FittedEccentricity fitEccentricity(final CircularOrbit previous, final Propagator propagator,
final int nbDays, final int nbOrbits) {
// fit eccentricity over one phasing cycle
final FittedEccentricity fittedE = new FittedEccentricity(previous, nbDays, nbOrbits);
fittedE.fit(propagator);
propagator.resetInitialState(new SpacecraftState(previous));
final AbsoluteDate start = previous.getDate();
// collapse mean evolution circular motion to its center point
return new CircularOrbit(previous.getA(),
previous.getCircularEx() - fittedE.dx0,
previous.getCircularEy() - fittedE.dy0,
previous.getI(), previous.getRightAscensionOfAscendingNode(),
previous.getAlphaV(), PositionAngle.TRUE,
previous.getFrame(), previous.getDate(),
previous.getMu());
// sample orbit for one phasing cycle
final FittedEccentricity fittedE = new FittedEccentricity(start, previous.getI(), nbDays, nbOrbits);
propagator.setMasterMode(60, (state, isLast) -> fittedE.addSamplingPoint(state.getOrbit()));
propagator.propagate(start, start.shiftedBy(Constants.JULIAN_DAY * nbDays));
fittedE.fit();
return fittedE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment