1 /* Copyright 2022-2026 Romain Serra
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.orekit.control.heuristics;
18
19 import org.hipparchus.CalculusFieldElement;
20 import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
21 import org.hipparchus.util.FastMath;
22 import org.orekit.orbits.FieldOrbit;
23 import org.orekit.propagation.FieldSpacecraftState;
24
25 /**
26 * Class modelling impulsive maneuvers to set the osculating semi-major axis to a given value.
27 * The impulse vector is tangential and computed in the same frame as the orbit.
28 * The resulting osculating eccentricity depends on the execution location. The instantaneous orbital plane is left unchanged.
29 * A constraint on the maximum magnitude can be optionally set.
30 * @see FieldAbstractInPlaneImpulseProvider
31 * @see OsculatingSmaChangeImpulseProvider
32 * @author Romain Serra
33 * @since 14.0
34 */
35 public class FieldSmaChangingImpulseProvider<T extends CalculusFieldElement<T>> extends FieldAbstractInPlaneImpulseProvider<T> {
36
37 /** Target osculating semi-major axis. */
38 private final T targetSemiMajorAxis;
39
40 /**
41 * Constructor with default maximum magnitude set to positive infinity (unconstrained).
42 * @param targetSemiMajorAxis osculating value to achieve
43 */
44 public FieldSmaChangingImpulseProvider(final T targetSemiMajorAxis) {
45 this(targetSemiMajorAxis.getField().getZero().newInstance(Double.POSITIVE_INFINITY), targetSemiMajorAxis);
46 }
47
48 /**
49 * Constructor.
50 * @param maximumMagnitude maximum magnitude
51 * @param targetSemiMajorAxis osculating value to achieve
52 */
53 public FieldSmaChangingImpulseProvider(final T maximumMagnitude, final T targetSemiMajorAxis) {
54 super(maximumMagnitude);
55 this.targetSemiMajorAxis = targetSemiMajorAxis;
56 }
57
58 @Override
59 public FieldVector3D<T> getUnconstrainedImpulse(final FieldSpacecraftState<T> state, final boolean isForward) {
60 final FieldOrbit<T> orbit = state.getOrbit();
61 final FieldVector3D<T> position = orbit.getPosition();
62 final FieldVector3D<T> velocity = orbit.getVelocity();
63 final T mu = orbit.getMu();
64 final T targetEnergy = mu.negate().divide(targetSemiMajorAxis.multiply(2));
65 final T targetSpeed = FastMath.sqrt((targetEnergy.add(mu.divide(position.getNorm2()))).multiply(2));
66 return velocity.normalize().scalarMultiply(targetSpeed.subtract(velocity.getNorm2()));
67 }
68 }