/** * Simple constructor. * * <p>The {@code applyBefore} parameter is mainly used when the differential effect is associated * with a maneuver. In this case, the parameter must be set to {@code false}. * * @param orbit0 original orbit at reference date * @param orbit1 shifted orbit at reference date * @param applyBefore if true, effect is applied both before and after reference date, if false it * is only applied after reference date * @param gravityField gravity field to use * @exception OrekitException if gravity field does not contain J2 coefficient */ public J2DifferentialEffect( final Orbit orbit0, final Orbit orbit1, final boolean applyBefore, final UnnormalizedSphericalHarmonicsProvider gravityField) throws OrekitException { this( orbit0, orbit1, applyBefore, gravityField.getAe(), gravityField.getMu(), -gravityField.onDate(orbit0.getDate()).getUnnormalizedCnm(2, 0)); }
/** * Simple constructor. * * <p>The {@code applyBefore} parameter is mainly used when the differential effect is associated * with a maneuver. In this case, the parameter must be set to {@code false}. * * @param original original state at reference date * @param directEffect direct effect changing the orbit * @param applyBefore if true, effect is applied both before and after reference date, if false it * is only applied after reference date * @param gravityField gravity field to use * @exception OrekitException if gravity field does not contain J2 coefficient */ public J2DifferentialEffect( final SpacecraftState original, final AdapterPropagator.DifferentialEffect directEffect, final boolean applyBefore, final UnnormalizedSphericalHarmonicsProvider gravityField) throws OrekitException { this( original, directEffect, applyBefore, gravityField.getAe(), gravityField.getMu(), -gravityField.onDate(original.getDate()).getUnnormalizedCnm(2, 0)); }
/** {@inheritDoc} */ @Override public void initializeStep(final AuxiliaryElements aux) throws OrekitException { // Equinoctial elements a = aux.getSma(); k = aux.getK(); h = aux.getH(); q = aux.getQ(); p = aux.getP(); lm = aux.getLM(); // Eccentricity ecc = aux.getEcc(); e2 = ecc * ecc; // Retrograde factor I = aux.getRetrogradeFactor(); // Equinoctial frame vectors f = aux.getVectorF(); g = aux.getVectorG(); // Central body rotation angle from equation 2.7.1-(3)(4). final Transform t = bodyFrame.getTransformTo(aux.getFrame(), aux.getDate()); final Vector3D xB = t.transformVector(Vector3D.PLUS_I); final Vector3D yB = t.transformVector(Vector3D.PLUS_J); theta = FastMath.atan2( -f.dotProduct(yB) + I * g.dotProduct(xB), f.dotProduct(xB) + I * g.dotProduct(yB)); // Direction cosines alpha = aux.getAlpha(); beta = aux.getBeta(); gamma = aux.getGamma(); // Equinoctial coefficients // A = sqrt(μ * a) final double A = aux.getA(); // B = sqrt(1 - h² - k²) final double B = aux.getB(); // C = 1 + p² + q² final double C = aux.getC(); // Common factors from equinoctial coefficients // 2 * a / A ax2oA = 2. * a / A; // B / A BoA = B / A; // 1 / AB ooAB = 1. / (A * B); // C / 2AB Co2AB = C * ooAB / 2.; // B / (A * (1 + B)) BoABpo = BoA / (1. + B); // &mu / a moa = provider.getMu() / a; // R / a roa = provider.getAe() / a; // Χ = 1 / B chi = 1. / B; chi2 = chi * chi; // mean motion n meanMotion = aux.getMeanMotion(); }