use of org.hipparchus.analysis.differentiation.DerivativeStructure in project Orekit by CS-SI.
the class CircularOrbit method getAlphaEDot.
/**
* Get the eccentric latitude argument derivative.
* <p>
* If the orbit was created without derivatives, the value returned is {@link Double#NaN}.
* </p>
* @return d(E + ω)/dt eccentric latitude argument derivative (rad/s)
* @since 9.0
*/
public double getAlphaEDot() {
final DerivativeStructure alphaVDS = FACTORY.build(alphaV, alphaVDot);
final DerivativeStructure exDS = FACTORY.build(ex, exDot);
final DerivativeStructure eyDS = FACTORY.build(ey, eyDot);
final DerivativeStructure alphaEDS = FieldCircularOrbit.trueToEccentric(alphaVDS, exDS, eyDS);
return alphaEDS.getPartialDerivative(1);
}
use of org.hipparchus.analysis.differentiation.DerivativeStructure in project Orekit by CS-SI.
the class CircularOrbit method getAlphaMDot.
/**
* Get the mean latitude argument derivative.
* <p>
* If the orbit was created without derivatives, the value returned is {@link Double#NaN}.
* </p>
* @return d(M + ω)/dt mean latitude argument derivative (rad/s)
* @since 9.0
*/
public double getAlphaMDot() {
final DerivativeStructure alphaVDS = FACTORY.build(alphaV, alphaVDot);
final DerivativeStructure exDS = FACTORY.build(ex, exDot);
final DerivativeStructure eyDS = FACTORY.build(ey, eyDot);
final DerivativeStructure alphaMDS = FieldCircularOrbit.eccentricToMean(FieldCircularOrbit.trueToEccentric(alphaVDS, exDS, eyDS), exDS, eyDS);
return alphaMDS.getPartialDerivative(1);
}
use of org.hipparchus.analysis.differentiation.DerivativeStructure in project Orekit by CS-SI.
the class IsotropicRadiationCNES95Convention method radiationPressureAcceleration.
/**
* {@inheritDoc}
*/
@Override
public FieldVector3D<DerivativeStructure> radiationPressureAcceleration(final AbsoluteDate date, final Frame frame, final Vector3D position, final Rotation rotation, final double mass, final Vector3D flux, final double[] parameters, final String paramName) throws OrekitException {
final DerivativeStructure absorptionCoeffDS;
final DerivativeStructure specularReflectionCoeffDS;
if (ABSORPTION_COEFFICIENT.equals(paramName)) {
absorptionCoeffDS = factory.variable(0, parameters[0]);
specularReflectionCoeffDS = factory.constant(parameters[1]);
} else if (REFLECTION_COEFFICIENT.equals(paramName)) {
absorptionCoeffDS = factory.constant(parameters[0]);
specularReflectionCoeffDS = factory.variable(0, parameters[1]);
} else {
throw new OrekitException(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, paramName, ABSORPTION_COEFFICIENT + ", " + REFLECTION_COEFFICIENT);
}
final DerivativeStructure kP = absorptionCoeffDS.subtract(1).multiply(specularReflectionCoeffDS.subtract(1)).multiply(4.0 / 9.0).add(1).multiply(crossSection);
return new FieldVector3D<>(kP.divide(mass), flux);
}
use of org.hipparchus.analysis.differentiation.DerivativeStructure in project Orekit by CS-SI.
the class DSSTTesseral method computeNSum.
/**
* Compute the n-SUM for potential derivatives components.
* @param date current date
* @param j resonant index <i>j</i>
* @param m resonant order <i>m</i>
* @param s d'Alembert characteristic <i>s</i>
* @param maxN maximum possible value for <i>n</i> index
* @param roaPow powers of R/a up to degree <i>n</i>
* @param ghMSJ G<sup>j</sup><sub>m,s</sub> and H<sup>j</sup><sub>m,s</sub> polynomials
* @param gammaMNS Γ<sup>m</sup><sub>n,s</sub>(γ) function
* @return Components of U<sub>n</sub> derivatives for fixed j, m, s
* @throws OrekitException if some error occurred
*/
private double[][] computeNSum(final AbsoluteDate date, final int j, final int m, final int s, final int maxN, final double[] roaPow, final GHmsjPolynomials ghMSJ, final GammaMnsFunction gammaMNS) throws OrekitException {
// spherical harmonics
final UnnormalizedSphericalHarmonics harmonics = provider.onDate(date);
// Potential derivatives components
double dUdaCos = 0.;
double dUdaSin = 0.;
double dUdhCos = 0.;
double dUdhSin = 0.;
double dUdkCos = 0.;
double dUdkSin = 0.;
double dUdlCos = 0.;
double dUdlSin = 0.;
double dUdAlCos = 0.;
double dUdAlSin = 0.;
double dUdBeCos = 0.;
double dUdBeSin = 0.;
double dUdGaCos = 0.;
double dUdGaSin = 0.;
// I^m
@SuppressWarnings("unused") final int Im = I > 0 ? 1 : (m % 2 == 0 ? 1 : -1);
// jacobi v, w, indices from 2.7.1-(15)
final int v = FastMath.abs(m - s);
final int w = FastMath.abs(m + s);
// Initialise lower degree nmin = (Max(2, m, |s|)) for summation over n
final int nmin = FastMath.max(FastMath.max(2, m), FastMath.abs(s));
// Get the corresponding Hansen object
final int sIndex = maxDegree + (j < 0 ? -s : s);
final int jIndex = FastMath.abs(j);
final HansenTesseralLinear hans = this.hansenObjects[sIndex][jIndex];
// n-SUM from nmin to N
for (int n = nmin; n <= maxN; n++) {
// If (n - s) is odd, the contribution is null because of Vmns
if ((n - s) % 2 == 0) {
// Vmns coefficient
final double vMNS = CoefficientsFactory.getVmns(m, n, s);
// Inclination function Gamma and derivative
final double gaMNS = gammaMNS.getValue(m, n, s);
final double dGaMNS = gammaMNS.getDerivative(m, n, s);
// Hansen kernel value and derivative
final double kJNS = hans.getValue(-n - 1, chi);
final double dkJNS = hans.getDerivative(-n - 1, chi);
// Gjms, Hjms polynomials and derivatives
final double gMSJ = ghMSJ.getGmsj(m, s, j);
final double hMSJ = ghMSJ.getHmsj(m, s, j);
final double dGdh = ghMSJ.getdGmsdh(m, s, j);
final double dGdk = ghMSJ.getdGmsdk(m, s, j);
final double dGdA = ghMSJ.getdGmsdAlpha(m, s, j);
final double dGdB = ghMSJ.getdGmsdBeta(m, s, j);
final double dHdh = ghMSJ.getdHmsdh(m, s, j);
final double dHdk = ghMSJ.getdHmsdk(m, s, j);
final double dHdA = ghMSJ.getdHmsdAlpha(m, s, j);
final double dHdB = ghMSJ.getdHmsdBeta(m, s, j);
// Jacobi l-index from 2.7.1-(15)
final int l = FastMath.min(n - m, n - FastMath.abs(s));
// Jacobi polynomial and derivative
final DerivativeStructure jacobi = JacobiPolynomials.getValue(l, v, w, factory.variable(0, gamma));
// Geopotential coefficients
final double cnm = harmonics.getUnnormalizedCnm(n, m);
final double snm = harmonics.getUnnormalizedSnm(n, m);
// Common factors from expansion of equations 3.3-4
final double cf_0 = roaPow[n] * Im * vMNS;
final double cf_1 = cf_0 * gaMNS * jacobi.getValue();
final double cf_2 = cf_1 * kJNS;
final double gcPhs = gMSJ * cnm + hMSJ * snm;
final double gsMhc = gMSJ * snm - hMSJ * cnm;
final double dKgcPhsx2 = 2. * dkJNS * gcPhs;
final double dKgsMhcx2 = 2. * dkJNS * gsMhc;
final double dUdaCoef = (n + 1) * cf_2;
final double dUdlCoef = j * cf_2;
final double dUdGaCoef = cf_0 * kJNS * (jacobi.getValue() * dGaMNS + gaMNS * jacobi.getPartialDerivative(1));
// dU / da components
dUdaCos += dUdaCoef * gcPhs;
dUdaSin += dUdaCoef * gsMhc;
// dU / dh components
dUdhCos += cf_1 * (kJNS * (cnm * dGdh + snm * dHdh) + h * dKgcPhsx2);
dUdhSin += cf_1 * (kJNS * (snm * dGdh - cnm * dHdh) + h * dKgsMhcx2);
// dU / dk components
dUdkCos += cf_1 * (kJNS * (cnm * dGdk + snm * dHdk) + k * dKgcPhsx2);
dUdkSin += cf_1 * (kJNS * (snm * dGdk - cnm * dHdk) + k * dKgsMhcx2);
// dU / dLambda components
dUdlCos += dUdlCoef * gsMhc;
dUdlSin += -dUdlCoef * gcPhs;
// dU / alpha components
dUdAlCos += cf_2 * (dGdA * cnm + dHdA * snm);
dUdAlSin += cf_2 * (dGdA * snm - dHdA * cnm);
// dU / dBeta components
dUdBeCos += cf_2 * (dGdB * cnm + dHdB * snm);
dUdBeSin += cf_2 * (dGdB * snm - dHdB * cnm);
// dU / dGamma components
dUdGaCos += dUdGaCoef * gcPhs;
dUdGaSin += dUdGaCoef * gsMhc;
}
}
return new double[][] { { dUdaCos, dUdaSin }, { dUdhCos, dUdhSin }, { dUdkCos, dUdkSin }, { dUdlCos, dUdlSin }, { dUdAlCos, dUdAlSin }, { dUdBeCos, dUdBeSin }, { dUdGaCos, dUdGaSin } };
}
use of org.hipparchus.analysis.differentiation.DerivativeStructure in project Orekit by CS-SI.
the class DSConverter method getState.
/**
* Get the state with the number of parameters consistent with force model.
* @param forceModel force model
* @return state with the number of parameters consistent with force model
*/
public FieldSpacecraftState<DerivativeStructure> getState(final ForceModel forceModel) {
// count the required number of parameters
int nbParams = 0;
for (final ParameterDriver driver : forceModel.getParametersDrivers()) {
if (driver.isSelected()) {
++nbParams;
}
}
// fill in intermediate slots
while (dsStates.size() < nbParams + 1) {
dsStates.add(null);
}
if (dsStates.get(nbParams) == null) {
// it is the first time we need this number of parameters
// we need to create the state
final DSFactory factory = new DSFactory(freeStateParameters + nbParams, 1);
final FieldSpacecraftState<DerivativeStructure> s0 = dsStates.get(0);
// orbit
final FieldPVCoordinates<DerivativeStructure> pv0 = s0.getPVCoordinates();
final FieldOrbit<DerivativeStructure> dsOrbit = new FieldCartesianOrbit<>(new TimeStampedFieldPVCoordinates<>(s0.getDate().toAbsoluteDate(), extend(pv0.getPosition(), factory), extend(pv0.getVelocity(), factory), extend(pv0.getAcceleration(), factory)), s0.getFrame(), s0.getMu());
// attitude
final FieldAngularCoordinates<DerivativeStructure> ac0 = s0.getAttitude().getOrientation();
final FieldAttitude<DerivativeStructure> dsAttitude = new FieldAttitude<>(s0.getAttitude().getReferenceFrame(), new TimeStampedFieldAngularCoordinates<>(dsOrbit.getDate(), extend(ac0.getRotation(), factory), extend(ac0.getRotationRate(), factory), extend(ac0.getRotationAcceleration(), factory)));
// mass
final DerivativeStructure dsM = extend(s0.getMass(), factory);
dsStates.set(nbParams, new FieldSpacecraftState<>(dsOrbit, dsAttitude, dsM));
}
return dsStates.get(nbParams);
}
Aggregations