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.analytical.gnss.data;
18  
19  import org.orekit.annotation.DefaultDataContext;
20  import org.orekit.data.DataContext;
21  import org.orekit.propagation.numerical.GLONASSNumericalPropagator;
22  import org.orekit.time.AbsoluteDate;
23  import org.orekit.time.GLONASSDate;
24  
25  /**
26   * Class for GLONASS ephemeris used by the {@link GLONASSNumericalPropagator}.
27   *
28   * @author Bryan Cazabonne
29   * @since 10.0
30   *
31   */
32  public class GLONASSEphemeris implements GLONASSOrbitalElements {
33  
34      /** Number of the current four year interval. */
35      private final int n4;
36  
37      /** Number of the current day in a four year interval. */
38      private final int nt;
39  
40      /** GLONASS ephemeris reference time. */
41      private final double tb;
42  
43      /** ECEF-X component of satellite coordinates. */
44      private final double x;
45  
46      /** ECEF-X component of satellite velocity. */
47      private final double xDot;
48  
49      /** ECEF-X component of satellite acceleration. */
50      private final double xDotDot;
51  
52      /** ECEF-Y component of satellite coordinates. */
53      private final double y;
54  
55      /** ECEF-Y component of satellite velocity. */
56      private final double yDot;
57  
58      /** ECEF-Y component of satellite acceleration. */
59      private final double yDotDot;
60  
61      /** ECEF-Z component of satellite coordinates. */
62      private final double z;
63  
64      /** ECEF-Z component of satellite velocity. */
65      private final double zDot;
66  
67      /** ECEF-Z component of satellite acceleration. */
68      private final double zDotDot;
69  
70      /** Date of applicability. */
71      private final AbsoluteDate date;
72  
73      /**
74       * Build a new instance.
75       *
76       * <p>This method uses the {@link DataContext#getDefault() default data context}.
77       *
78       * @param n4 number of the current four year interval
79       * @param nt number of the current day in a four year interval
80       * @param tb reference time, s
81       * @param x ECEF-X component of satellite coordinates, m
82       * @param xDot ECEF-X component of satellite velocity, m/s
83       * @param xDotDot ECEF-X component of satellite acceleration, m/s²
84       * @param y ECEF-Y component of satellite coordinates, m
85       * @param yDot ECEF-Y component of satellite velocity, m/s
86       * @param yDotDot ECEF-Y component of satellite acceleration, m/s²
87       * @param z ECEF-Z component of satellite coordinates, m
88       * @param zDot ECEF-Z component of satellite velocity, m/s
89       * @param zDotDot ECEF-Z component of satellite acceleration, m/s²
90       * @see #GLONASSEphemeris(int, int, double, double, double, double, double, double,
91       * double, double, double, double, AbsoluteDate)
92       */
93      @DefaultDataContext
94      public GLONASSEphemeris(final int n4, final int nt, final double tb,
95                              final double x, final double xDot, final double xDotDot,
96                              final double y, final double yDot, final double yDotDot,
97                              final double z, final double zDot, final double zDotDot) {
98          this(n4, nt, tb, x, xDot, xDotDot, y, yDot, yDotDot, z, zDot, zDotDot,
99              new GLONASSDate(nt, n4, tb,
100                     DataContext.getDefault().getTimeScales().getGLONASS()).getDate());
101     }
102 
103     /**
104      * Build a new instance.
105      *
106      * @param n4      number of the current four year interval
107      * @param nt      number of the current day in a four year interval
108      * @param tb      reference time, s
109      * @param x       ECEF-X component of satellite coordinates, m
110      * @param xDot    ECEF-X component of satellite velocity, m/s
111      * @param xDotDot ECEF-X component of satellite acceleration, m/s²
112      * @param y       ECEF-Y component of satellite coordinates, m
113      * @param yDot    ECEF-Y component of satellite velocity, m/s
114      * @param yDotDot ECEF-Y component of satellite acceleration, m/s²
115      * @param z       ECEF-Z component of satellite coordinates, m
116      * @param zDot    ECEF-Z component of satellite velocity, m/s
117      * @param zDotDot ECEF-Z component of satellite acceleration, m/s²
118      * @param date    of applicability corresponding to {@code nt}, {@code n4}, and {@code
119      *                tb}.
120      * @since 10.1
121      */
122     public GLONASSEphemeris(final int n4, final int nt, final double tb,
123                             final double x, final double xDot, final double xDotDot,
124                             final double y, final double yDot, final double yDotDot,
125                             final double z, final double zDot, final double zDotDot,
126                             final AbsoluteDate date) {
127         this.n4 = n4;
128         this.nt = nt;
129         this.tb = tb;
130         this.x = x;
131         this.xDot = xDot;
132         this.xDotDot = xDotDot;
133         this.y = y;
134         this.yDot = yDot;
135         this.yDotDot = yDotDot;
136         this.z = z;
137         this.zDot = zDot;
138         this.zDotDot = zDotDot;
139         this.date = date;
140     }
141 
142     @Override
143     public AbsoluteDate getDate() {
144         return date;
145     }
146 
147     @Override
148     public int getN4() {
149         return n4;
150     }
151 
152     @Override
153     public int getNa() {
154         return nt;
155     }
156 
157     @Override
158     public double getTime() {
159         return tb;
160     }
161 
162     @Override
163     public double getXDot() {
164         return xDot;
165     }
166 
167     @Override
168     public double getX() {
169         return x;
170     }
171 
172     @Override
173     public double getXDotDot() {
174         return xDotDot;
175     }
176 
177     @Override
178     public double getYDot() {
179         return yDot;
180     }
181 
182     @Override
183     public double getY() {
184         return y;
185     }
186 
187     @Override
188     public double getYDotDot() {
189         return yDotDot;
190     }
191 
192     @Override
193     public double getZDot() {
194         return zDot;
195     }
196 
197     @Override
198     public double getZ() {
199         return z;
200     }
201 
202     @Override
203     public double getZDotDot() {
204         return zDotDot;
205     }
206 
207 }