1   /* Copyright 2002-2024 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.data;
18  
19  import org.hipparchus.CalculusFieldElement;
20  
21  /** Class for general terms.
22   * @author Luc Maisonobe
23   */
24  class GeneralTerm extends SeriesTerm {
25  
26      /** Coefficient for mean anomaly of the Moon. */
27      private final int cL;
28  
29      /** Coefficient for mean anomaly of the Sun. */
30      private final int cLPrime;
31  
32      /** Coefficient for L - Ω where L is the mean longitude of the Moon. */
33      private final int cF;
34  
35      /** Coefficient for mean elongation of the Moon from the Sun. */
36      private final int cD;
37  
38      /** Coefficient for mean longitude of the ascending node of the Moon. */
39      private final int cOmega;
40  
41      /** Coefficient for mean Mercury longitude. */
42      private final int cMe;
43  
44      /** Coefficient for mean Venus longitude. */
45      private final int cVe;
46  
47      /** Coefficient for mean Earth longitude. */
48      private final int cE;
49  
50      /** Coefficient for mean Mars longitude. */
51      private final int cMa;
52  
53      /** Coefficient for mean Jupiter longitude. */
54      private final int cJu;
55  
56      /** Coefficient for mean Saturn longitude. */
57      private final int cSa;
58  
59      /** Coefficient for mean Uranus longitude. */
60      private final int cUr;
61  
62      /** Coefficient for mean Neptune longitude. */
63      private final int cNe;
64  
65      /** Coefficient for general accumulated precession in longitude. */
66      private final int cPa;
67  
68      /** Build a general term for nutation series.
69       * @param cL coefficient for mean anomaly of the Moon
70       * @param cLPrime coefficient for mean anomaly of the Sun
71       * @param cF coefficient for L - Ω where L is the mean longitude of the Moon
72       * @param cD coefficient for mean elongation of the Moon from the Sun
73       * @param cOmega coefficient for mean longitude of the ascending node of the Moon
74       * @param cMe coefficient for mean Mercury longitude
75       * @param cVe coefficient for mean Venus longitude
76       * @param cE coefficient for mean Earth longitude
77       * @param cMa coefficient for mean Mars longitude
78       * @param cJu coefficient for mean Jupiter longitude
79       * @param cSa coefficient for mean Saturn longitude
80       * @param cUr coefficient for mean Uranus longitude
81       * @param cNe coefficient for mean Neptune longitude
82       * @param cPa coefficient for general accumulated precession in longitude
83       */
84      GeneralTerm(final int cL, final int cLPrime, final int cF, final int cD, final int cOmega,
85                  final int cMe, final int cVe, final int cE, final int cMa, final int cJu,
86                  final int cSa, final int cUr, final int cNe, final int cPa) {
87          this.cL      = cL;
88          this.cLPrime = cLPrime;
89          this.cF      = cF;
90          this.cD      = cD;
91          this.cOmega  = cOmega;
92          this.cMe     = cMe;
93          this.cVe     = cVe;
94          this.cE      = cE;
95          this.cMa     = cMa;
96          this.cJu     = cJu;
97          this.cSa     = cSa;
98          this.cUr     = cUr;
99          this.cNe     = cNe;
100         this.cPa     = cPa;
101     }
102 
103     /** {@inheritDoc} */
104     protected double argument(final BodiesElements elements) {
105         return cL * elements.getL() + cLPrime * elements.getLPrime() + cF * elements.getF() +
106                cD * elements.getD() + cOmega * elements.getOmega() +
107                cMe * elements.getLMe() + cVe * elements.getLVe() + cE  * elements.getLE() +
108                cMa * elements.getLMa() + cJu * elements.getLJu() +
109                cSa * elements.getLSa() + cUr * elements.getLUr() +
110                cNe * elements.getLNe() + cPa * elements.getPa();
111     }
112 
113     /** {@inheritDoc} */
114     protected double argumentDerivative(final BodiesElements elements) {
115         return cL * elements.getLDot() + cLPrime * elements.getLPrimeDot() + cF * elements.getFDot() +
116                cD * elements.getDDot() + cOmega * elements.getOmegaDot() +
117                cMe * elements.getLMeDot() + cVe * elements.getLVeDot() + cE  * elements.getLEDot() +
118                cMa * elements.getLMaDot() + cJu * elements.getLJuDot() +
119                cSa * elements.getLSaDot() + cUr * elements.getLUrDot() +
120                cNe * elements.getLNeDot() + cPa * elements.getPaDot();
121     }
122 
123     /** {@inheritDoc} */
124     protected <T extends CalculusFieldElement<T>> T argument(final FieldBodiesElements<T> elements) {
125         return elements.getL().multiply(cL).
126                add(elements.getLPrime().multiply(cLPrime)).
127                add(elements.getF().multiply(cF)).
128                add(elements.getD().multiply(cD)).
129                add(elements.getOmega().multiply(cOmega)).
130                add(elements.getLMe().multiply(cMe)).
131                add(elements.getLVe().multiply(cVe)).
132                add(elements.getLE().multiply(cE)).
133                add(elements.getLMa().multiply(cMa)).
134                add(elements.getLJu().multiply(cJu)).
135                add(elements.getLSa().multiply(cSa)).
136                add(elements.getLUr().multiply(cUr)).
137                add(elements.getLNe().multiply(cNe)).
138                add(elements.getPa().multiply(cPa));
139     }
140 
141     /** {@inheritDoc} */
142     protected <T extends CalculusFieldElement<T>> T argumentDerivative(final FieldBodiesElements<T> elements) {
143         return elements.getLDot().multiply(cL).
144                add(elements.getLPrimeDot().multiply(cLPrime)).
145                add(elements.getFDot().multiply(cF)).
146                add(elements.getDDot().multiply(cD)).
147                add(elements.getOmegaDot().multiply(cOmega)).
148                add(elements.getLMeDot().multiply(cMe)).
149                add(elements.getLVeDot().multiply(cVe)).
150                add(elements.getLEDot().multiply(cE)).
151                add(elements.getLMaDot().multiply(cMa)).
152                add(elements.getLJuDot().multiply(cJu)).
153                add(elements.getLSaDot().multiply(cSa)).
154                add(elements.getLUrDot().multiply(cUr)).
155                add(elements.getLNeDot().multiply(cNe)).
156                add(elements.getPaDot().multiply(cPa));
157     }
158 
159 }