PolynomialThrustSegment.java

  1. /* Copyright 2002-2024 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. /** One polynomial segment of a thrust profile.
  25.  * @author Luc Maisonobe
  26.  * @since 12.0
  27.  */
  28. public class PolynomialThrustSegment {

  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.     /** Get thrust vector at a specified date.
  53.      * @param date date to consider
  54.      * @return thrust at {@code date} (N)
  55.      */
  56.     public Vector3D getThrustVector(final AbsoluteDate date) {
  57.         final double dt = date.durationFrom(referenceDate);
  58.         return new Vector3D(xThrust.value(dt), yThrust.value(dt), zThrust.value(dt));
  59.     }

  60.     /** Get thrust vector at a specified date.
  61.      * @param <T> type of the field elements
  62.      * @param date date to consider
  63.      * @return thrust at {@code date} (N)
  64.      */
  65.     public <T extends CalculusFieldElement<T>> FieldVector3D<T> getThrustVector(final FieldAbsoluteDate<T> date) {
  66.         final T dt = date.durationFrom(referenceDate);
  67.         return new FieldVector3D<>(xThrust.value(dt), yThrust.value(dt), zThrust.value(dt));
  68.     }

  69. }