1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.propagation.semianalytical.dsst.forces;
18
19 import org.hipparchus.Field;
20 import org.hipparchus.RealFieldElement;
21 import org.hipparchus.util.FastMath;
22 import org.hipparchus.util.MathArrays;
23 import org.hipparchus.util.MathUtils;
24 import org.orekit.forces.drag.DragForce;
25 import org.orekit.forces.drag.DragSensitive;
26 import org.orekit.forces.drag.IsotropicDrag;
27 import org.orekit.models.earth.atmosphere.Atmosphere;
28 import org.orekit.propagation.FieldSpacecraftState;
29 import org.orekit.propagation.SpacecraftState;
30 import org.orekit.propagation.events.EventDetector;
31 import org.orekit.propagation.events.FieldEventDetector;
32 import org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements;
33 import org.orekit.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;
34 import org.orekit.utils.Constants;
35 import org.orekit.utils.ParameterDriver;
36
37
38
39
40
41
42
43
44
45
46 public class DSSTAtmosphericDrag extends AbstractGaussianContribution {
47
48
49 private static final double GAUSS_THRESHOLD = 6.0e-10;
50
51
52 private static final double ATMOSPHERE_ALTITUDE_MAX = 1000000.;
53
54
55 private final DragForce drag;
56
57
58 private final double rbar;
59
60
61
62
63
64 public DSSTAtmosphericDrag(final DragForce force, final double mu) {
65
66 super("DSST-drag-", GAUSS_THRESHOLD, force, mu);
67 this.drag = force;
68 this.rbar = ATMOSPHERE_ALTITUDE_MAX + Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
69 }
70
71
72
73
74
75
76
77 public DSSTAtmosphericDrag(final Atmosphere atmosphere, final double cd,
78 final double area, final double mu) {
79 this(atmosphere, new IsotropicDrag(area, cd), mu);
80 }
81
82
83
84
85
86
87 public DSSTAtmosphericDrag(final Atmosphere atmosphere, final DragSensitive spacecraft, final double mu) {
88
89
90 this(new DragForce(atmosphere, spacecraft), mu);
91 }
92
93
94
95
96 public Atmosphere getAtmosphere() {
97 return drag.getAtmosphere();
98 }
99
100
101
102
103
104
105
106
107 public double getRbar() {
108 return rbar;
109 }
110
111
112 public EventDetector[] getEventsDetectors() {
113 return null;
114 }
115
116
117 @Override
118 public <T extends RealFieldElement<T>> FieldEventDetector<T>[] getFieldEventsDetectors(final Field<T> field) {
119 return null;
120 }
121
122
123 protected double[] getLLimits(final SpacecraftState state, final AuxiliaryElements auxiliaryElements) {
124
125 final double perigee = auxiliaryElements.getSma() * (1. - auxiliaryElements.getEcc());
126
127
128 if (perigee > rbar) {
129 return new double[2];
130 }
131 final double apogee = auxiliaryElements.getSma() * (1. + auxiliaryElements.getEcc());
132
133 if (apogee < rbar) {
134 return new double[] { -FastMath.PI + MathUtils.normalizeAngle(state.getLv(), 0),
135 FastMath.PI + MathUtils.normalizeAngle(state.getLv(), 0) };
136 }
137
138 final double fb = FastMath.acos(((auxiliaryElements.getSma() * (1. - auxiliaryElements.getEcc() * auxiliaryElements.getEcc()) / rbar) - 1.) / auxiliaryElements.getEcc());
139 final double wW = FastMath.atan2(auxiliaryElements.getH(), auxiliaryElements.getK());
140 return new double[] {wW - fb, wW + fb};
141 }
142
143
144 protected <T extends RealFieldElement<T>> T[] getLLimits(final FieldSpacecraftState<T> state,
145 final FieldAuxiliaryElements<T> auxiliaryElements) {
146
147 final Field<T> field = state.getDate().getField();
148 final T zero = field.getZero();
149
150 final T[] tab = MathArrays.buildArray(field, 2);
151
152 final T perigee = auxiliaryElements.getSma().multiply(auxiliaryElements.getEcc().negate().add(1.));
153
154 if (perigee.getReal() > rbar) {
155 return tab;
156 }
157 final T apogee = auxiliaryElements.getSma().multiply(auxiliaryElements.getEcc().add(1.));
158
159 if (apogee.getReal() < rbar) {
160 tab[0] = MathUtils.normalizeAngle(state.getLv(), zero).subtract(FastMath.PI);
161 tab[1] = MathUtils.normalizeAngle(state.getLv(), zero).add(FastMath.PI);
162 return tab;
163 }
164
165 final T fb = FastMath.acos(((auxiliaryElements.getSma().multiply(auxiliaryElements.getEcc().multiply(auxiliaryElements.getEcc()).negate().add(1.)).divide(rbar)).subtract(1.)).divide(auxiliaryElements.getEcc()));
166 final T wW = FastMath.atan2(auxiliaryElements.getH(), auxiliaryElements.getK());
167
168 tab[0] = wW.subtract(fb);
169 tab[1] = wW.add(fb);
170 return tab;
171 }
172
173
174 @Override
175 protected ParameterDriver[] getParametersDriversWithoutMu() {
176 return drag.getParametersDrivers();
177 }
178
179
180
181
182
183 public DragSensitive getSpacecraft() {
184 return drag.getSpacecraft();
185 }
186
187
188
189
190
191 public DragForce getDrag() {
192 return drag;
193 }
194 }