Control3DVectorCostType.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.forces.maneuvers;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  20. import org.hipparchus.geometry.euclidean.threed.Vector3D;

  21. /** Enumerate on types of cost for 3D control vector (thrust as a force or acceleration, including an impulse)
  22.  * at a given time. It is typically a norm (for a single, gimbaled thruster it would be the Euclidean one)
  23.  * and relates to the mass flow rate.
  24.  * See ROSS, I. Michael. Space Trajectory Optimization and L1-norm Optimal Control Problems.
  25.  * Modern astrodynamics, 2006, vol. 1, p. 155.
  26.  * <p>It is used widely across the {@link org.orekit.forces.maneuvers} package.</p>
  27.  * <p>Note that norms in finite-dimensional vector spaces are all equivalent in a topological sense.</p>
  28.  * @see org.orekit.forces.maneuvers.ImpulseManeuver
  29.  * @see org.orekit.forces.maneuvers.FieldImpulseManeuver
  30.  * @see org.orekit.forces.maneuvers.Maneuver
  31.  * @author Romain Serra
  32.  * @since 12.0
  33.  */
  34. public enum Control3DVectorCostType {

  35.     /** Zero cost (free control). */
  36.     NONE {
  37.         @Override
  38.         public double evaluate(final Vector3D controlVector) {
  39.             return 0.;
  40.         }

  41.         @Override
  42.         public <T extends CalculusFieldElement<T>> T evaluate(final FieldVector3D<T> controlVector) {
  43.             return controlVector.getX().getField().getZero();
  44.         }
  45.     },

  46.     /** 1-norm. */
  47.     ONE_NORM {
  48.         @Override
  49.         public double evaluate(final Vector3D controlVector) {
  50.             return controlVector.getNorm1();
  51.         }

  52.         @Override
  53.         public <T extends CalculusFieldElement<T>> T evaluate(final FieldVector3D<T> controlVector) {
  54.             return controlVector.getNorm1();
  55.         }
  56.     },

  57.     /** 2-norm also known as Euclidean. */
  58.     TWO_NORM {
  59.         @Override
  60.         public double evaluate(final Vector3D controlVector) {
  61.             return controlVector.getNorm();
  62.         }

  63.         @Override
  64.         public <T extends CalculusFieldElement<T>> T evaluate(final FieldVector3D<T> controlVector) {
  65.             return controlVector.getNorm();
  66.         }
  67.     },

  68.     /** Infinite norm also known as Max. */
  69.     INF_NORM {
  70.         @Override
  71.         public double evaluate(final Vector3D controlVector) {
  72.             return controlVector.getNormInf();
  73.         }

  74.         @Override
  75.         public <T extends CalculusFieldElement<T>> T evaluate(final FieldVector3D<T> controlVector) {
  76.             return controlVector.getNormInf();
  77.         }
  78.     };

  79.     /** Evaluate the cost of the input seen as a 3D control vector.
  80.      * @param controlVector vector
  81.      * @return cost of vector
  82.      */
  83.     public abstract double evaluate(Vector3D controlVector);

  84.     /** Evaluate the cost of the input seen as a 3D control vector.
  85.      * @param <T> CalculusFieldElement used
  86.      * @param controlVector vector
  87.      * @return cost of vector
  88.      */
  89.     public abstract <T extends CalculusFieldElement<T>> T evaluate(FieldVector3D<T> controlVector);

  90. }