FieldGHIJjsPolynomials.java

  1. /* Copyright 2002-2025 CS GROUP
  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.propagation.semianalytical.dsst.utilities;

  18. import org.hipparchus.Field;
  19. import org.hipparchus.CalculusFieldElement;

  20. /** Compute the G<sub>js</sub>, H<sub>js</sub>, I<sub>js</sub> and J<sub>js</sub>
  21.  *  polynomials in the equinoctial elements h, k and the direction cosines α and β
  22.  *  and their partial derivatives with respect to k, h, α and β.
  23.  *  <p>
  24.  *  The expressions used are equations 4.1-(10) from the Danielson paper.
  25.  *  </p>
  26.  *  @author Lucian Barbulescu
  27.  *  @author Bryan Cazabonne (field translation)
  28.  * @param <T> type of the field elements
  29.  */
  30. public class FieldGHIJjsPolynomials<T extends CalculusFieldElement<T>> {

  31.     /** C<sub>j</sub>(k, h), S<sub>j</sub>(k, h) coefficient.
  32.      * (k, h) are the (x, y) component of the eccentricity vector in equinoctial elements
  33.      */
  34.     private final FieldCjSjCoefficient<T> cjsjKH;

  35.     /** C<sub>j</sub>(α, β), S<sub>j</sub>(α, β) coefficient.
  36.      * (α, β) are the direction cosines
  37.      */
  38.     private final FieldCjSjCoefficient<T> cjsjAB;

  39.     /** Create a set of G<sub>js</sub>, H<sub>js</sub>, I<sub>js</sub> and J<sub>js</sub> polynomials.
  40.      *  @param k X component of the eccentricity vector
  41.      *  @param h Y component of the eccentricity vector
  42.      *  @param alpha direction cosine α
  43.      *  @param beta direction cosine β
  44.      **/
  45.     public FieldGHIJjsPolynomials(final T k, final T h,
  46.                                   final T alpha, final T beta) {
  47.         final Field<T> field = k.getField();
  48.         this.cjsjKH = new FieldCjSjCoefficient<>(k, h, field);
  49.         this.cjsjAB = new FieldCjSjCoefficient<>(alpha, beta, field);
  50.     }

  51.     /** Get the G<sub>js</sub> coefficient.
  52.      * @param j j subscript
  53.      * @param s s subscript
  54.      * @return the G<sub>js</sub>
  55.      */
  56.     public T getGjs(final int j, final int s) {
  57.         return cjsjKH.getCj(j).multiply(cjsjAB.getCj(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getSj(s)));
  58.     }

  59.     /** Get the dG<sub>js</sub> / dk coefficient.
  60.      * @param j j subscript
  61.      * @param s s subscript
  62.      * @return the dG<sub>js</sub> / dk
  63.      */
  64.     public T getdGjsdk(final int j, final int s) {
  65.         return cjsjKH.getDcjDk(j).multiply(cjsjAB.getCj(s)).add(cjsjKH.getDsjDk(j).multiply(cjsjAB.getSj(s)));
  66.     }

  67.     /** Get the dG<sub>js</sub> / dh coefficient.
  68.      * @param j j subscript
  69.      * @param s s subscript
  70.      * @return the dG<sub>js</sub> / dh
  71.      */
  72.     public T getdGjsdh(final int j, final int s) {
  73.         return cjsjKH.getDcjDh(j).multiply(cjsjAB.getCj(s)).add(cjsjKH.getDsjDh(j).multiply(cjsjAB.getSj(s)));
  74.     }

  75.     /** Get the dG<sub>js</sub> / dα coefficient.
  76.      * @param j j subscript
  77.      * @param s s subscript
  78.      * @return the dG<sub>js</sub> / dα
  79.      */
  80.     public T getdGjsdAlpha(final int j, final int s) {
  81.         return cjsjKH.getCj(j).multiply(cjsjAB.getDcjDk(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getDsjDk(s)));
  82.     }

  83.     /** Get the dG<sub>js</sub> / dβ coefficient.
  84.      * @param j j subscript
  85.      * @param s s subscript
  86.      * @return the dG<sub>js</sub> / dβ
  87.      */
  88.     public T getdGjsdBeta(final int j, final int s) {
  89.         return cjsjKH.getCj(j).multiply(cjsjAB.getDcjDh(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getDsjDh(s)));
  90.     }

  91.     /** Get the H<sub>js</sub> coefficient.
  92.      * @param j j subscript
  93.      * @param s s subscript
  94.      * @return the H<sub>js</sub>
  95.      */
  96.     public T getHjs(final int j, final int s) {
  97.         return cjsjKH.getCj(j).multiply(cjsjAB.getSj(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getCj(s)));
  98.     }

  99.     /** Get the dH<sub>js</sub> / dk coefficient.
  100.      * @param j j subscript
  101.      * @param s s subscript
  102.      * @return the H<sub>js</sub> / dk
  103.      */
  104.     public T getdHjsdk(final int j, final int s) {
  105.         return cjsjKH.getDcjDk(j).multiply(cjsjAB.getSj(s)).subtract(cjsjKH.getDsjDk(j).multiply(cjsjAB.getCj(s)));
  106.     }

  107.     /** Get the dH<sub>js</sub> / dh coefficient.
  108.      * @param j j subscript
  109.      * @param s s subscript
  110.      * @return the H<sub>js</sub> / dh
  111.      */
  112.     public T getdHjsdh(final int j, final int s) {
  113.         return cjsjKH.getDcjDh(j).multiply(cjsjAB.getSj(s)).subtract(cjsjKH.getDsjDh(j).multiply(cjsjAB.getCj(s)));
  114.     }

  115.     /** Get the dH<sub>js</sub> / dα coefficient.
  116.      * @param j j subscript
  117.      * @param s s subscript
  118.      * @return the H<sub>js</sub> / dα
  119.      */
  120.     public T getdHjsdAlpha(final int j, final int s) {
  121.         return cjsjKH.getCj(j).multiply(cjsjAB.getDsjDk(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getDcjDk(s)));
  122.     }

  123.     /** Get the dH<sub>js</sub> / dβ coefficient.
  124.      * @param j j subscript
  125.      * @param s s subscript
  126.      * @return the H<sub>js</sub> / dβ
  127.      */
  128.     public T getdHjsdBeta(final int j, final int s) {
  129.         return cjsjKH.getCj(j).multiply(cjsjAB.getDsjDh(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getDcjDh(s)));
  130.     }

  131.     /** Get the I<sub>js</sub> coefficient.
  132.      * @param j j subscript
  133.      * @param s s subscript
  134.      * @return the I<sub>js</sub>
  135.      */
  136.     public T getIjs(final int j, final int s) {
  137.         return cjsjKH.getCj(j).multiply(cjsjAB.getSj(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getCj(s)));
  138.     }

  139.     /** Get the dI<sub>js</sub> / dk coefficient.
  140.      * @param j j subscript
  141.      * @param s s subscript
  142.      * @return the I<sub>js</sub> / dk
  143.      */
  144.     public T getdIjsdk(final int j, final int s) {
  145.         return cjsjKH.getDcjDk(j).multiply(cjsjAB.getSj(s)).add(cjsjKH.getDsjDk(j).multiply(cjsjAB.getCj(s)));
  146.     }

  147.     /** Get the dI<sub>js</sub> / dh coefficient.
  148.      * @param j j subscript
  149.      * @param s s subscript
  150.      * @return the I<sub>js</sub> / dh
  151.      */
  152.     public T getdIjsdh(final int j, final int s) {
  153.         return cjsjKH.getDcjDh(j).multiply(cjsjAB.getSj(s)).add(cjsjKH.getDsjDh(j).multiply(cjsjAB.getCj(s)));
  154.     }

  155.     /** Get the dI<sub>js</sub> / dα coefficient.
  156.      * @param j j subscript
  157.      * @param s s subscript
  158.      * @return the I<sub>js</sub> / dα
  159.      */
  160.     public T getdIjsdAlpha(final int j, final int s) {
  161.         return cjsjKH.getCj(j).multiply(cjsjAB.getDsjDk(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getDcjDk(s)));
  162.     }

  163.     /** Get the dI<sub>js</sub> / dβ coefficient.
  164.      * @param j j subscript
  165.      * @param s s subscript
  166.      * @return the I<sub>js</sub> / dβ
  167.      */
  168.     public T getdIjsdBeta(final int j, final int s) {
  169.         return cjsjKH.getCj(j).multiply(cjsjAB.getDsjDh(s)).add(cjsjKH.getSj(j).multiply(cjsjAB.getDcjDh(s)));
  170.     }

  171.     /** Get the J<sub>js</sub> coefficient.
  172.      * @param j j subscript
  173.      * @param s s subscript
  174.      * @return the J<sub>js</sub>
  175.      */
  176.     public T getJjs(final int j, final int s) {
  177.         return cjsjKH.getCj(j).multiply(cjsjAB.getCj(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getSj(s)));
  178.     }

  179.     /** Get the dJ<sub>js</sub> / dk coefficient.
  180.      * @param j j subscript
  181.      * @param s s subscript
  182.      * @return the J<sub>js</sub> / dk
  183.      */
  184.     public T getdJjsdk(final int j, final int s) {
  185.         return cjsjKH.getDcjDk(j).multiply(cjsjAB.getCj(s)).subtract(cjsjKH.getDsjDk(j).multiply(cjsjAB.getSj(s)));
  186.     }
  187.     /** Get the dJ<sub>js</sub> / dh coefficient.
  188.      * @param j j subscript
  189.      * @param s s subscript
  190.      * @return the J<sub>js</sub> / dh
  191.      */
  192.     public T getdJjsdh(final int j, final int s) {
  193.         return cjsjKH.getDcjDh(j).multiply(cjsjAB.getCj(s)).subtract(cjsjKH.getDsjDh(j).multiply(cjsjAB.getSj(s)));
  194.     }
  195.     /** Get the dJ<sub>js</sub> / dα coefficient.
  196.      * @param j j subscript
  197.      * @param s s subscript
  198.      * @return the J<sub>js</sub> / dα
  199.      */
  200.     public T getdJjsdAlpha(final int j, final int s) {
  201.         return cjsjKH.getCj(j).multiply(cjsjAB.getDcjDk(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getDsjDk(s)));
  202.     }
  203.     /** Get the dJ<sub>js</sub> / dβ coefficient.
  204.      * @param j j subscript
  205.      * @param s s subscript
  206.      * @return the J<sub>js</sub> / dβ
  207.      */
  208.     public T getdJjsdBeta(final int j, final int s) {
  209.         return cjsjKH.getCj(j).multiply(cjsjAB.getDcjDh(s)).subtract(cjsjKH.getSj(j).multiply(cjsjAB.getDsjDh(s)));
  210.     }

  211. }