1 /* Copyright 2022-2025 Luc Maisonobe
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.hipparchus.Field;
21 import org.orekit.annotation.DefaultDataContext;
22 import org.orekit.attitudes.AttitudeProvider;
23 import org.orekit.data.DataContext;
24 import org.orekit.frames.Frame;
25 import org.orekit.frames.Frames;
26 import org.orekit.propagation.analytical.gnss.FieldGnssPropagator;
27 import org.orekit.propagation.analytical.gnss.FieldGnssPropagatorBuilder;
28
29 import java.util.function.Function;
30
31 /**
32 * Base class for GNSS almanacs.
33 * @param <T> type of the field elements
34 * @param <O> type of the orbital elements (non-field version)
35 * @author Luc Maisonobe
36 * @since 13.0
37 */
38 public abstract class FieldAbstractAlmanac<T extends CalculusFieldElement<T>,
39 O extends AbstractAlmanac<O>>
40 extends FieldCommonGnssData<T, O> {
41
42 /** Constructor from non-field instance.
43 * @param field field to which elements belong
44 * @param original regular non-field instance
45 */
46 protected FieldAbstractAlmanac(final Field<T> field, final O original) {
47 super(field, original);
48 }
49
50 /** Constructor from different field instance.
51 * @param <V> type of the old field elements
52 * @param original regular non-field instance
53 * @param converter for field elements
54 */
55 protected <V extends CalculusFieldElement<V>> FieldAbstractAlmanac(final Function<V, T> converter,
56 final FieldAbstractAlmanac<V, O> original) {
57 super(converter, original);
58 }
59
60 /**
61 * Get the propagator corresponding to the navigation message.
62 * <p>
63 * The attitude provider is set by default to be aligned with the EME2000 frame.<br>
64 * The mass is set by default to the
65 * {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
66 * The ECI frame is set by default to the
67 * {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
68 * context.<br>
69 * The ECEF frame is set by default to the
70 * {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP
71 * CIO/2010-based ITRF simple EOP} in the default data context.
72 * </p><p>
73 * This constructor uses the {@link DataContext#getDefault() default data context}
74 * </p>
75 * @return the propagator corresponding to the navigation message
76 * @see #getPropagator(Frames)
77 * @see #getPropagator(Frames, AttitudeProvider, Frame, Frame, CalculusFieldElement)
78 */
79 @DefaultDataContext
80 public FieldGnssPropagator<T> getPropagator() {
81 return new FieldGnssPropagatorBuilder<>(this).build();
82 }
83
84 /**
85 * Get the propagator corresponding to the navigation message.
86 * <p>
87 * The attitude provider is set by default to be aligned with the EME2000 frame.<br>
88 * The mass is set by default to the
89 * {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
90 * The ECI frame is set by default to the
91 * {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
92 * context.<br>
93 * The ECEF frame is set by default to the
94 * {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP
95 * CIO/2010-based ITRF simple EOP} in the default data context.
96 * </p>
97 * @param frames set of frames to use
98 * @return the propagator corresponding to the navigation message
99 * @see #getPropagator()
100 * @see #getPropagator(Frames, AttitudeProvider, Frame, Frame, CalculusFieldElement)
101 */
102 public FieldGnssPropagator<T> getPropagator(final Frames frames) {
103 return new FieldGnssPropagatorBuilder<>(this, frames).build();
104 }
105
106 /**
107 * Get the propagator corresponding to the navigation message.
108 * @param frames set of frames to use
109 * @param provider attitude provider
110 * @param inertial inertial frame, use to provide the propagated orbit
111 * @param bodyFixed body fixed frame, corresponding to the navigation message
112 * @param mass spacecraft mass in kg
113 * @return the propagator corresponding to the navigation message
114 * @see #getPropagator()
115 * @see #getPropagator(Frames)
116 */
117 public FieldGnssPropagator<T> getPropagator(final Frames frames, final AttitudeProvider provider,
118 final Frame inertial, final Frame bodyFixed, final T mass) {
119 return new FieldGnssPropagatorBuilder<>(this, frames).
120 attitudeProvider(provider).
121 eci(inertial).
122 ecef(bodyFixed).
123 mass(mass).
124 build();
125 }
126
127 }