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