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.geometry.euclidean.threed.Vector3D;
20 import org.hipparchus.util.FastMath;
21 import org.orekit.orbits.Orbit;
22 import org.orekit.propagation.SpacecraftState;
23
24 /**
25 * Class modelling impulsive maneuvers to set the osculating semi-major axis to a given value.
26 * The impulse vector is tangential and computed in the same frame as the orbit.
27 * The resulting osculating eccentricity depends on the execution location. The instantaneous orbital plane is left unchanged.
28 * A constraint on the maximum magnitude can be optionally set.
29 * @see AbstractInPlaneImpulseProvider
30 * @author Romain Serra
31 * @since 14.0
32 */
33 public class OsculatingSmaChangeImpulseProvider extends AbstractInPlaneImpulseProvider {
34
35 /** Target osculating semi-major axis. */
36 private final double targetSemiMajorAxis;
37
38 /**
39 * Constructor with default maximum magnitude set to positive infinity (unconstrained).
40 * @param targetSemiMajorAxis osculating value to achieve
41 */
42 public OsculatingSmaChangeImpulseProvider(final double targetSemiMajorAxis) {
43 this(Double.POSITIVE_INFINITY, targetSemiMajorAxis);
44 }
45
46 /**
47 * Constructor.
48 * @param maximumMagnitude maximum magnitude
49 * @param targetSemiMajorAxis osculating value to achieve
50 */
51 public OsculatingSmaChangeImpulseProvider(final double maximumMagnitude, final double targetSemiMajorAxis) {
52 super(maximumMagnitude);
53 this.targetSemiMajorAxis = targetSemiMajorAxis;
54 }
55
56 @Override
57 public Vector3D getUnconstrainedImpulse(final SpacecraftState state, final boolean isForward) {
58 final Orbit orbit = state.getOrbit();
59 final Vector3D position = orbit.getPosition();
60 final Vector3D velocity = orbit.getVelocity();
61 final double mu = orbit.getMu();
62 final double targetEnergy = -mu / (2. * targetSemiMajorAxis);
63 final double targetSpeed = FastMath.sqrt(2. * (targetEnergy + mu / position.getNorm2()));
64 return velocity.normalize().scalarMultiply(targetSpeed - velocity.getNorm2());
65 }
66 }