1 /* Copyright 2022-2025 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.indirect.adjoint.cost;
18
19 import org.hipparchus.geometry.euclidean.threed.Vector3D;
20 import org.orekit.propagation.events.EventDetector;
21
22 import java.util.stream.Stream;
23
24 /**
25 * Class for unbounded energy cost with Cartesian coordinates neglecting the mass consumption.
26 * Under this assumption, the mass is constant and there is no need to consider the corresponding adjoint variable.
27 * Here, the control vector is chosen as the acceleration given by thrusting, expressed in the propagation frame.
28 * This leads to the optimal thrust force being equal to the adjoint velocity vector times the mass.
29 * @author Romain Serra
30 * @since 12.2
31 */
32 public class UnboundedCartesianEnergyNeglectingMass extends AbstractCartesianCost {
33
34 /**
35 * Constructor.
36 * @param name name
37 */
38 public UnboundedCartesianEnergyNeglectingMass(final String name) {
39 super(name, 0.);
40 }
41
42 /** {@inheritDoc} */
43 @Override
44 public Vector3D getThrustAccelerationVector(final double[] adjointVariables, final double mass) {
45 return new Vector3D(adjointVariables[3], adjointVariables[4], adjointVariables[5]);
46 }
47
48 /** {@inheritDoc} */
49 @Override
50 public void updateAdjointDerivatives(final double[] adjointVariables, final double mass,
51 final double[] adjointDerivatives) {
52 // nothing to do
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public double getHamiltonianContribution(final double[] adjointVariables, final double mass) {
58 final Vector3D thrustAcceleration = getThrustAccelerationVector(adjointVariables, mass);
59 return -thrustAcceleration.getNormSq() / 2.;
60 }
61
62 /** {@inheritDoc} */
63 @Override
64 public Stream<EventDetector> getEventDetectors() {
65 return Stream.empty();
66 }
67
68 }