PolynomialThrustSegment.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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.propulsion;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.analysis.polynomials.PolynomialFunction;
  20. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  21. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  22. import org.orekit.time.AbsoluteDate;
  23. import org.orekit.time.FieldAbsoluteDate;

  24. /** Thrust vector given as polynomials for the Cartesian coordinates.
  25.  * @author Luc Maisonobe
  26.  * @since 12.0
  27.  */
  28. public class PolynomialThrustSegment implements ThrustVectorProvider {

  29.     /** Reference date. */
  30.     private final AbsoluteDate referenceDate;

  31.     /** Thrust along X direction (N). */
  32.     private final PolynomialFunction xThrust;

  33.     /** Thrust along Y direction (N). */
  34.     private final PolynomialFunction yThrust;

  35.     /** Thrust along Z direction (N). */
  36.     private final PolynomialFunction zThrust;

  37.     /** Simple constructor.
  38.      * @param referenceDate reference date of the polynomials
  39.      * @param xThrust thrust along X direction (N)
  40.      * @param yThrust thrust along Y direction (N)
  41.      * @param zThrust thrust along Z direction (N)
  42.      */
  43.     public PolynomialThrustSegment(final AbsoluteDate referenceDate,
  44.                                    final PolynomialFunction xThrust,
  45.                                    final PolynomialFunction yThrust,
  46.                                    final PolynomialFunction zThrust) {
  47.         this.referenceDate = referenceDate;
  48.         this.xThrust       = xThrust;
  49.         this.yThrust       = yThrust;
  50.         this.zThrust       = zThrust;
  51.     }

  52.     /** {@inheritDoc} */
  53.     @Override
  54.     public Vector3D getThrustVector(final AbsoluteDate date, final double mass) {
  55.         final double dt = date.durationFrom(referenceDate);
  56.         return new Vector3D(xThrust.value(dt), yThrust.value(dt), zThrust.value(dt));
  57.     }

  58.     /** {@inheritDoc} */
  59.     @Override
  60.     public <T extends CalculusFieldElement<T>> FieldVector3D<T> getThrustVector(final FieldAbsoluteDate<T> date,
  61.                                                                                 final T mass) {
  62.         final T dt = date.durationFrom(referenceDate);
  63.         return new FieldVector3D<>(xThrust.value(dt), yThrust.value(dt), zThrust.value(dt));
  64.     }
  65. }