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;
18
19 import org.orekit.annotation.DefaultDataContext;
20 import org.orekit.attitudes.AttitudeProvider;
21 import org.orekit.attitudes.FrameAlignedProvider;
22 import org.orekit.data.DataContext;
23 import org.orekit.frames.Frame;
24 import org.orekit.frames.Frames;
25 import org.orekit.propagation.Propagator;
26 import org.orekit.propagation.analytical.gnss.data.GNSSConstants;
27 import org.orekit.propagation.analytical.gnss.data.SBASOrbitalElements;
28 import org.orekit.utils.IERSConventions;
29
30 /**
31 * This nested class aims at building a SBASPropagator.
32 * <p>It implements the classical builder pattern.</p>
33 * @since 11.0
34 * @author Bryan Cazabonne
35 */
36 public class SBASPropagatorBuilder {
37
38 /** The SBAS orbital elements. */
39 private final SBASOrbitalElements orbit;
40
41 /** The Earth gravity coefficient used for SBAS propagation. */
42 private double mu;
43
44 /** The attitude provider. */
45 private AttitudeProvider attitudeProvider;
46
47 /** The mass. */
48 private double mass;
49
50 /** The ECI frame. */
51 private Frame eci;
52
53 /** The ECEF frame. */
54 private Frame ecef;
55
56 /** Initializes the builder.
57 * <p>The SBAS orbital elements is the only requested parameter to build a SBASPropagator.</p>
58 * <p>The attitude provider is set by default be aligned with the EME2000 frame.<br>
59 * The Earth gravity coefficient is set by default to the
60 * {@link org.orekit.propagation.analytical.gnss.data.GNSSConstants#SBAS_MU SBAS_MU}.<br>
61 * The mass is set by default to the
62 * {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
63 * The ECI frame is set by default to the
64 * {@link org.orekit.frames.Predefined#EME2000 EME2000 frame}.<br>
65 * The ECEF frame is set by default to the
66 * {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
67 * </p>
68 * <p>This constructor uses the {@link DataContext#getDefault() default data context}.</p>
69 *
70 * @param sbasOrbElt the SBAS orbital elements to be used by the SBAS propagator.
71 * @see #attitudeProvider(AttitudeProvider provider)
72 * @see #mu(double coefficient)
73 * @see #mass(double mass)
74 * @see #eci(Frame inertial)
75 * @see #ecef(Frame bodyFixed)
76 * @since 12.0
77 */
78 @DefaultDataContext
79 public SBASPropagatorBuilder(final SBASOrbitalElements sbasOrbElt) {
80 this(sbasOrbElt, DataContext.getDefault().getFrames());
81 }
82
83 /** Initializes the builder.
84 * <p>The SBAS orbital elements is the only requested parameter to build a SBASPropagator.</p>
85 * <p>The attitude provider is set by default to be aligned with the EME2000 frame.<br>
86 * The Earth gravity coefficient is set by default to the
87 * {@link org.orekit.propagation.analytical.gnss.data.GNSSConstants#SBAS_MU SBAS_MU}.<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}.<br>
92 * The ECEF frame is set by default to the
93 * {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
94 * </p>
95 *
96 * @param sbasOrbElt the SBAS orbital elements to be used by the SBAS propagator.
97 * @param frames set of reference frames to use to initialize {@link
98 * #ecef(Frame)}, {@link #eci(Frame)}, and {@link
99 * #attitudeProvider(AttitudeProvider)}.
100 * @see #attitudeProvider(AttitudeProvider provider)
101 * @see #mu(double coefficient)
102 * @see #mass(double mass)
103 * @see #eci(Frame inertial)
104 * @see #ecef(Frame bodyFixed)
105 */
106 public SBASPropagatorBuilder(final SBASOrbitalElements sbasOrbElt, final Frames frames) {
107 this.orbit = sbasOrbElt;
108 this.mass = Propagator.DEFAULT_MASS;
109 this.eci = frames.getEME2000();
110 this.ecef = frames.getITRF(IERSConventions.IERS_2010, true);
111 this.mu = GNSSConstants.SBAS_MU;
112 this.attitudeProvider = new FrameAlignedProvider(eci);
113 }
114
115 /** Sets the attitude provider.
116 *
117 * @param userProvider the attitude provider
118 * @return the updated builder
119 */
120 public SBASPropagatorBuilder attitudeProvider(final AttitudeProvider userProvider) {
121 this.attitudeProvider = userProvider;
122 return this;
123 }
124
125 /** Sets the Earth gravity coefficient.
126 *
127 * @param coefficient the Earth gravity coefficient
128 * @return the updated builder
129 */
130 public SBASPropagatorBuilder mu(final double coefficient) {
131 this.mu = coefficient;
132 return this;
133 }
134
135 /** Sets the mass.
136 *
137 * @param userMass the mass (in kg)
138 * @return the updated builder
139 */
140 public SBASPropagatorBuilder mass(final double userMass) {
141 this.mass = userMass;
142 return this;
143 }
144
145 /** Sets the Earth Centered Inertial frame used for propagation.
146 *
147 * @param inertial the ECI frame
148 * @return the updated builder
149 */
150 public SBASPropagatorBuilder eci(final Frame inertial) {
151 this.eci = inertial;
152 return this;
153 }
154
155 /** Sets the Earth Centered Earth Fixed frame assimilated to the WGS84 ECEF.
156 *
157 * @param bodyFixed the ECEF frame
158 * @return the updated builder
159 */
160 public SBASPropagatorBuilder ecef(final Frame bodyFixed) {
161 this.ecef = bodyFixed;
162 return this;
163 }
164
165 /** Finalizes the build.
166 *
167 * @return the built SBASPropagator
168 */
169 public SBASPropagator build() {
170 return new SBASPropagator(orbit, eci, ecef, attitudeProvider, mass, mu);
171 }
172
173 }