1 /* Copyright 2002-2024 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.GNSSOrbitalElements;
27 import org.orekit.utils.IERSConventions;
28
29 /**
30 * This nested class aims at building a GNSSPropagator.
31 * <p>It implements the classical builder pattern.</p>
32 * @author Pascal Parraud
33 * @since 11.0
34 */
35 public class GNSSPropagatorBuilder {
36
37 //////////
38 // Required parameter
39 //////////
40
41 /** The GNSS orbital elements. */
42 private final GNSSOrbitalElements orbit;
43
44 ///////////
45 // Optional parameters
46 //////////
47
48 /** The attitude provider. */
49 private AttitudeProvider attitudeProvider;
50
51 /** The mass. */
52 private double mass;
53
54 /** The ECI frame. */
55 private Frame eci;
56
57 /** The ECEF frame. */
58 private Frame ecef;
59
60 /**
61 * Initializes the builder.
62 * <p>The GNSS orbital elements is the only requested parameter to build a GNSSPropagator.</p>
63 * <p>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>
73 *
74 * <p>This constructor uses the {@link DataContext#getDefault() default data context}.
75 * Another data context can be set using
76 * {@code Builder(final GNSSOrbitalElements gpsOrbElt, final Frames frames)}</p>
77 *
78 * @param gnssOrbElt the GNSS orbital elements to be used by the GNSSpropagator.
79 * @see #attitudeProvider(AttitudeProvider provider)
80 * @see #mass(double mass)
81 * @see #eci(Frame inertial)
82 * @see #ecef(Frame bodyFixed)
83 */
84 @DefaultDataContext
85 public GNSSPropagatorBuilder(final GNSSOrbitalElements gnssOrbElt) {
86 this(gnssOrbElt, DataContext.getDefault().getFrames());
87 }
88
89 /** Initializes the builder.
90 * <p>The GNSS orbital elements is the only requested parameter to build a GNSSPropagator.</p>
91 * <p>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 Frames#getEME2000() EME2000 frame}.<br>
96 * The ECEF frame is set by default to the
97 * {@link Frames#getITRF(IERSConventions, boolean)} CIO/2010-based ITRF simple EOP}.
98 * </p>
99 *
100 * @param gnssOrbElt the GNSS orbital elements to be used by the GNSSpropagator.
101 * @param frames set of frames to use.
102 * @see #attitudeProvider(AttitudeProvider provider)
103 * @see #mass(double mass)
104 * @see #eci(Frame inertial)
105 * @see #ecef(Frame bodyFixed)
106 */
107 public GNSSPropagatorBuilder(final GNSSOrbitalElements gnssOrbElt, final Frames frames) {
108 this.orbit = gnssOrbElt;
109 this.mass = Propagator.DEFAULT_MASS;
110 this.eci = frames.getEME2000();
111 this.ecef = frames.getITRF(IERSConventions.IERS_2010, true);
112 this.attitudeProvider = FrameAlignedProvider.of(this.eci);
113 }
114
115 /** Sets the attitude provider.
116 *
117 * @param userProvider the attitude provider
118 * @return the updated builder
119 */
120 public GNSSPropagatorBuilder attitudeProvider(final AttitudeProvider userProvider) {
121 this.attitudeProvider = userProvider;
122 return this;
123 }
124
125 /** Sets the mass.
126 *
127 * @param userMass the mass (in kg)
128 * @return the updated builder
129 */
130 public GNSSPropagatorBuilder mass(final double userMass) {
131 this.mass = userMass;
132 return this;
133 }
134
135 /** Sets the Earth Centered Inertial frame used for propagation.
136 *
137 * @param inertial the ECI frame
138 * @return the updated builder
139 */
140 public GNSSPropagatorBuilder eci(final Frame inertial) {
141 this.eci = inertial;
142 return this;
143 }
144
145 /** Sets the Earth Centered Earth Fixed frame assimilated to the WGS84 ECEF.
146 *
147 * @param bodyFixed the ECEF frame
148 * @return the updated builder
149 */
150 public GNSSPropagatorBuilder ecef(final Frame bodyFixed) {
151 this.ecef = bodyFixed;
152 return this;
153 }
154
155 /** Finalizes the build.
156 *
157 * @return the built GNSSPropagator
158 */
159 public GNSSPropagator build() {
160 return new GNSSPropagator(orbit, eci, ecef, attitudeProvider, mass);
161 }
162
163 }