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.hipparchus.CalculusFieldElement;
20  import org.orekit.annotation.DefaultDataContext;
21  import org.orekit.attitudes.AttitudeProvider;
22  import org.orekit.data.DataContext;
23  import org.orekit.frames.Frame;
24  import org.orekit.frames.Frames;
25  import org.orekit.gnss.SatelliteSystem;
26  import org.orekit.propagation.analytical.gnss.GNSSPropagator;
27  import org.orekit.propagation.analytical.gnss.GNSSPropagatorBuilder;
28  import org.orekit.time.TimeScales;
29  
30  /**
31   * Base class for GNSS almanacs.
32   * @param <O> type of the orbital elements
33   * @author Pascal Parraud
34   * @since 11.0
35   */
36  public abstract class AbstractAlmanac<O extends AbstractAlmanac<O>> extends CommonGnssData<O> {
37  
38      /**
39       * Constructor.
40       * @param mu Earth's universal gravitational parameter
41       * @param angularVelocity mean angular velocity of the Earth for the GNSS model
42       * @param weeksInCycle number of weeks in the GNSS cycle
43       * @param timeScales      known time scales
44       * @param system          satellite system to consider for interpreting week number
45       *                        (may be different from real system, for example in Rinex nav, weeks
46       *                        are always according to GPS)
47       */
48      public AbstractAlmanac(final double mu, final double angularVelocity, final int weeksInCycle,
49                             final TimeScales timeScales, final SatelliteSystem system) {
50          super(mu, angularVelocity, weeksInCycle, timeScales, system);
51      }
52  
53      /** Constructor from field instance.
54       * @param <T> type of the field elements
55       * @param <A> type of the orbital elements (non-field version)
56       * @param original regular field instance
57       */
58      protected <T extends CalculusFieldElement<T>,
59                 A extends AbstractAlmanac<A>> AbstractAlmanac(final FieldAbstractAlmanac<T, A> original) {
60          super(original);
61      }
62  
63      /**
64       * Get the propagator corresponding to the navigation message.
65       * <p>
66       * The attitude provider is set by default to be aligned with the EME2000 frame.<br>
67       * The mass is set by default to the
68       *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
69       * The ECI frame is set by default to the
70       *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
71       *  context.<br>
72       * The ECEF frame is set by default to the
73       *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP
74       *  CIO/2010-based ITRF simple EOP} in the default data context.
75       * </p><p>
76       * This constructor uses the {@link DataContext#getDefault() default data context}
77       * </p>
78       * @return the propagator corresponding to the navigation message
79       * @see #getPropagator(Frames)
80       * @see #getPropagator(Frames, AttitudeProvider, Frame, Frame, double)
81       * @since 12.0
82       */
83      @DefaultDataContext
84      public GNSSPropagator getPropagator() {
85          return new GNSSPropagatorBuilder(this).build();
86      }
87  
88      /**
89       * Get the propagator corresponding to the navigation message.
90       * <p>
91       * The attitude provider is set by default to be aligned with the EME2000 frame.<br>
92       * The mass is set by default to the
93       *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
94       * The ECI frame is set by default to the
95       *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
96       *  context.<br>
97       * The ECEF frame is set by default to the
98       *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP
99       *  CIO/2010-based ITRF simple EOP} in the default data context.
100      * </p>
101      * @param frames set of frames to use
102      * @return the propagator corresponding to the navigation message
103      * @see #getPropagator()
104      * @see #getPropagator(Frames, AttitudeProvider, Frame, Frame, double)
105      * @since 13.0
106      */
107     public GNSSPropagator getPropagator(final Frames frames) {
108         return new GNSSPropagatorBuilder(this, frames).build();
109     }
110 
111     /**
112      * Get the propagator corresponding to the navigation message.
113      * @param frames set of frames to use
114      * @param provider attitude provider
115      * @param inertial inertial frame, use to provide the propagated orbit
116      * @param bodyFixed body fixed frame, corresponding to the navigation message
117      * @param mass spacecraft mass in kg
118      * @return the propagator corresponding to the navigation message
119      * @see #getPropagator()
120      * @see #getPropagator(Frames)
121      * @since 13.0
122      */
123     public GNSSPropagator getPropagator(final Frames frames, final AttitudeProvider provider,
124                                         final Frame inertial, final Frame bodyFixed, final double mass) {
125         return new GNSSPropagatorBuilder(this, frames).attitudeProvider(provider)
126                                                       .eci(inertial)
127                                                       .ecef(bodyFixed)
128                                                       .mass(mass)
129                                                       .build();
130     }
131 
132 }