UnboundedCartesianEnergyNeglectingMass.java

  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. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  19. import org.orekit.propagation.events.EventDetector;

  20. import java.util.stream.Stream;

  21. /**
  22.  * Class for unbounded energy cost with Cartesian coordinates neglecting the mass consumption.
  23.  * Under this assumption, the mass is constant and there is no need to consider the corresponding adjoint variable.
  24.  * Here, the control vector is chosen as the acceleration given by thrusting, expressed in the propagation frame.
  25.  * This leads to the optimal thrust force being equal to the adjoint velocity vector times the mass.
  26.  * @author Romain Serra
  27.  * @since 12.2
  28.  */
  29. public class UnboundedCartesianEnergyNeglectingMass extends AbstractCartesianCost {

  30.     /**
  31.      * Constructor.
  32.      * @param name name
  33.      */
  34.     public UnboundedCartesianEnergyNeglectingMass(final String name) {
  35.         super(name, 0.);
  36.     }

  37.     /** {@inheritDoc} */
  38.     @Override
  39.     public Vector3D getThrustAccelerationVector(final double[] adjointVariables, final double mass) {
  40.         return new Vector3D(adjointVariables[3], adjointVariables[4], adjointVariables[5]);
  41.     }

  42.     /** {@inheritDoc} */
  43.     @Override
  44.     public void updateAdjointDerivatives(final double[] adjointVariables, final double mass,
  45.                                          final double[] adjointDerivatives) {
  46.         // nothing to do
  47.     }

  48.     /** {@inheritDoc} */
  49.     @Override
  50.     public double getHamiltonianContribution(final double[] adjointVariables, final double mass) {
  51.         final Vector3D thrustAcceleration = getThrustAccelerationVector(adjointVariables, mass);
  52.         return -thrustAcceleration.getNormSq() / 2.;
  53.     }

  54.     /** {@inheritDoc} */
  55.     @Override
  56.     public Stream<EventDetector> getEventDetectors() {
  57.         return Stream.empty();
  58.     }

  59. }