1 /* Copyright 2002-2019 CS Systèmes d'Information
2 * Licensed to CS Systèmes d'Information (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.RealFieldElement;
20
21 /** Class for tide terms.
22 * <p>
23 * BEWARE! For consistency with all the other Poisson series terms,
24 * the elements in γ, l, l', F, D and Ω are ADDED together to compute
25 * the argument of the term. In classical tides series, the computed
26 * argument is cGamma * γ - (cL * l + cLPrime * l' + cF * F + cD * D
27 * + cOmega * Ω). So at parsing time, the signs of cL, cLPrime, cF,
28 * cD and cOmega must already have been reversed so the addition
29 * performed here will work. This is done automatically when the
30 * parser has been configured with a call to {@link
31 * PoissonSeriesParser#withDoodson(int, int)} as the relationship
32 * between the Doodson arguments and the traditional Delaunay
33 * arguments ensures the proper sign is known.
34 * </p>
35 * @param <T> the type of the field elements
36 * @author Luc Maisonobe
37 */
38 class TideTerm extends SeriesTerm {
39
40 /** Coefficient for γ = GMST + π tide parameter. */
41 private final int cGamma;
42
43 /** Coefficient for mean anomaly of the Moon. */
44 private final int cL;
45
46 /** Coefficient for mean anomaly of the Sun. */
47 private final int cLPrime;
48
49 /** Coefficient for L - Ω where L is the mean longitude of the Moon. */
50 private final int cF;
51
52 /** Coefficient for mean elongation of the Moon from the Sun. */
53 private final int cD;
54
55 /** Coefficient for mean longitude of the ascending node of the Moon. */
56 private final int cOmega;
57
58 /** Build a tide term for nutation series.
59 * @param cGamma coefficient for γ = GMST + π tide parameter
60 * @param cL coefficient for mean anomaly of the Moon
61 * @param cLPrime coefficient for mean anomaly of the Sun
62 * @param cF coefficient for L - Ω where L is the mean longitude of the Moon
63 * @param cD coefficient for mean elongation of the Moon from the Sun
64 * @param cOmega coefficient for mean longitude of the ascending node of the Moon
65 */
66 TideTerm(final int cGamma,
67 final int cL, final int cLPrime, final int cF, final int cD, final int cOmega) {
68 this.cGamma = cGamma;
69 this.cL = cL;
70 this.cLPrime = cLPrime;
71 this.cF = cF;
72 this.cD = cD;
73 this.cOmega = cOmega;
74 }
75
76 /** {@inheritDoc} */
77 protected double argument(final BodiesElements elements) {
78 return cGamma * elements.getGamma() +
79 cL * elements.getL() + cLPrime * elements.getLPrime() + cF * elements.getF() +
80 cD * elements.getD() + cOmega * elements.getOmega();
81 }
82
83 /** {@inheritDoc} */
84 protected double argumentDerivative(final BodiesElements elements) {
85 return cGamma * elements.getGammaDot() +
86 cL * elements.getLDot() + cLPrime * elements.getLPrimeDot() + cF * elements.getFDot() +
87 cD * elements.getDDot() + cOmega * elements.getOmegaDot();
88 }
89
90 /** {@inheritDoc} */
91 protected <T extends RealFieldElement<T>> T argument(final FieldBodiesElements<T> elements) {
92 return elements.getGamma().multiply(cGamma).
93 add(elements.getL().multiply(cL)).
94 add(elements.getLPrime().multiply(cLPrime)).
95 add(elements.getF().multiply(cF)).
96 add(elements.getD().multiply(cD)).
97 add(elements.getOmega().multiply(cOmega));
98 }
99
100 /** {@inheritDoc} */
101 protected <T extends RealFieldElement<T>> T argumentDerivative(final FieldBodiesElements<T> elements) {
102 return elements.getGammaDot().multiply(cGamma).
103 add(elements.getLDot().multiply(cL)).
104 add(elements.getLPrimeDot().multiply(cLPrime)).
105 add(elements.getFDot().multiply(cF)).
106 add(elements.getDDot().multiply(cD)).
107 add(elements.getOmegaDot().multiply(cOmega));
108 }
109
110 }