open-space-toolkit-astrodynamics 5.1.5__py310-none-any.whl → 5.2.0__py310-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/METADATA +1 -1
- open_space_toolkit_astrodynamics-5.2.0.dist-info/RECORD +96 -0
- ostk/__init__.py +1 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-310-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/converters.py +44 -6
- ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.5 +0 -0
- ostk/astrodynamics/pytrajectory/pystate.py +1 -3
- ostk/astrodynamics/test/access/__init__.py +1 -0
- ostk/astrodynamics/test/access/test_generator.py +248 -0
- ostk/astrodynamics/test/conjunction/messages/ccsds/__init__.py +1 -0
- ostk/astrodynamics/test/conjunction/messages/ccsds/conftest.py +325 -0
- ostk/astrodynamics/test/conjunction/messages/ccsds/data/cdm.json +303 -0
- ostk/astrodynamics/test/conjunction/messages/ccsds/test_cdm.py +416 -0
- ostk/astrodynamics/test/dynamics/__init__.py +1 -0
- ostk/astrodynamics/test/dynamics/test_atmospheric_drag.py +128 -0
- ostk/astrodynamics/test/dynamics/test_central_body_gravity.py +58 -0
- ostk/astrodynamics/test/dynamics/test_dynamics.py +50 -0
- ostk/astrodynamics/test/dynamics/test_position_derivative.py +51 -0
- ostk/astrodynamics/test/dynamics/test_third_body_gravity.py +67 -0
- ostk/astrodynamics/test/dynamics/test_thruster.py +142 -0
- ostk/astrodynamics/test/event_condition/test_angular_condition.py +113 -0
- ostk/astrodynamics/test/event_condition/test_boolean_condition.py +55 -0
- ostk/astrodynamics/test/event_condition/test_coe_condition.py +87 -0
- ostk/astrodynamics/test/event_condition/test_instant_condition.py +48 -0
- ostk/astrodynamics/test/event_condition/test_logical_condition.py +120 -0
- ostk/astrodynamics/test/event_condition/test_real_condition.py +50 -0
- ostk/astrodynamics/test/flight/__init__.py +1 -0
- ostk/astrodynamics/test/flight/profile/__init__.py +1 -0
- ostk/astrodynamics/test/flight/profile/test_state.py +144 -0
- ostk/astrodynamics/test/flight/system/__init__.py +1 -0
- ostk/astrodynamics/test/flight/system/test_propulsion_system.py +46 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system.py +91 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system_builder.py +71 -0
- ostk/astrodynamics/test/flight/test_profile.py +153 -0
- ostk/astrodynamics/test/flight/test_system.py +55 -0
- ostk/astrodynamics/test/guidance_law/test_constant_thrust.py +91 -0
- ostk/astrodynamics/test/guidance_law/test_qlaw.py +139 -0
- ostk/astrodynamics/test/solvers/__init__.py +1 -0
- ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +181 -0
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +153 -0
- ostk/astrodynamics/test/test_access.py +2 -6
- ostk/astrodynamics/test/test_converters.py +213 -6
- ostk/astrodynamics/test/test_viewer.py +1 -2
- ostk/astrodynamics/test/trajectory/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/conftest.py +18 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/data/opm_1.yaml +44 -0
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/test_opm.py +108 -0
- ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean.py +65 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_long.py +102 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_brouwer_lyddane_mean_short.py +102 -0
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +167 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +331 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +130 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +195 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +380 -0
- ostk/astrodynamics/test/trajectory/orbit/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/test_pass.py +55 -0
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_angular_velocity.py +30 -0
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_attitude_quaternion.py +18 -0
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_position.py +107 -0
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_velocity.py +115 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinates_broker.py +84 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinates_subset.py +43 -0
- ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +314 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +81 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +64 -0
- ostk/astrodynamics/test/trajectory/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/test_orbit.py +92 -0
- ostk/astrodynamics/test/trajectory/test_propagator.py +402 -0
- ostk/astrodynamics/test/trajectory/test_segment.py +288 -0
- ostk/astrodynamics/test/trajectory/test_sequence.py +459 -0
- ostk/astrodynamics/test/trajectory/test_state.py +223 -0
- ostk/astrodynamics/test/trajectory/test_state_builder.py +171 -0
- ostk/astrodynamics/viewer.py +1 -3
- open_space_toolkit_astrodynamics-5.1.5.dist-info/RECORD +0 -25
- {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/WHEEL +0 -0
- {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/top_level.txt +0 -0
- {open_space_toolkit_astrodynamics-5.1.5.dist-info → open_space_toolkit_astrodynamics-5.2.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,314 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
import numpy as np
|
6
|
+
import math
|
7
|
+
|
8
|
+
from ostk.physics.time import Instant, Duration
|
9
|
+
from ostk.physics.coordinate import Frame
|
10
|
+
|
11
|
+
from ostk.astrodynamics.trajectory import State
|
12
|
+
from ostk.astrodynamics.trajectory.state import (
|
13
|
+
NumericalSolver,
|
14
|
+
CoordinatesBroker,
|
15
|
+
CoordinatesSubset,
|
16
|
+
)
|
17
|
+
from ostk.astrodynamics.event_condition import RealCondition
|
18
|
+
|
19
|
+
|
20
|
+
def oscillator(x, dxdt, _):
|
21
|
+
dxdt[0] = x[1]
|
22
|
+
dxdt[1] = -x[0]
|
23
|
+
return dxdt
|
24
|
+
|
25
|
+
|
26
|
+
def get_state_vec(time: float) -> np.ndarray:
|
27
|
+
return np.array([math.sin(time), math.cos(time)])
|
28
|
+
|
29
|
+
|
30
|
+
@pytest.fixture
|
31
|
+
def coordinates_subsets() -> list[CoordinatesSubset]:
|
32
|
+
return [CoordinatesSubset("Subset", 2)]
|
33
|
+
|
34
|
+
|
35
|
+
@pytest.fixture
|
36
|
+
def coordinates_broker(
|
37
|
+
coordinates_subsets: list[CoordinatesSubset],
|
38
|
+
) -> CoordinatesBroker:
|
39
|
+
return CoordinatesBroker(coordinates_subsets)
|
40
|
+
|
41
|
+
|
42
|
+
@pytest.fixture
|
43
|
+
def start_instant() -> Instant:
|
44
|
+
return Instant.J2000()
|
45
|
+
|
46
|
+
|
47
|
+
@pytest.fixture
|
48
|
+
def frame() -> Frame:
|
49
|
+
return Frame.GCRF()
|
50
|
+
|
51
|
+
|
52
|
+
@pytest.fixture
|
53
|
+
def initial_state(
|
54
|
+
start_instant: Instant,
|
55
|
+
frame: Frame,
|
56
|
+
coordinates_broker: CoordinatesBroker,
|
57
|
+
) -> State:
|
58
|
+
return State(start_instant, get_state_vec(0.0), frame, coordinates_broker)
|
59
|
+
|
60
|
+
|
61
|
+
@pytest.fixture
|
62
|
+
def custom_condition() -> RealCondition:
|
63
|
+
return RealCondition(
|
64
|
+
"Custom",
|
65
|
+
RealCondition.Criterion.StrictlyPositive,
|
66
|
+
lambda state: (state.get_instant() - Instant.J2000()).in_seconds(),
|
67
|
+
5.0,
|
68
|
+
)
|
69
|
+
|
70
|
+
|
71
|
+
@pytest.fixture
|
72
|
+
def log_type() -> NumericalSolver.LogType:
|
73
|
+
return NumericalSolver.LogType.NoLog
|
74
|
+
|
75
|
+
|
76
|
+
@pytest.fixture
|
77
|
+
def variable_size_stepper_type() -> NumericalSolver.StepperType:
|
78
|
+
return NumericalSolver.StepperType.RungeKuttaCashKarp54
|
79
|
+
|
80
|
+
|
81
|
+
@pytest.fixture
|
82
|
+
def fixed_size_stepper_type() -> NumericalSolver.StepperType:
|
83
|
+
return NumericalSolver.StepperType.RungeKutta4
|
84
|
+
|
85
|
+
|
86
|
+
@pytest.fixture
|
87
|
+
def initial_time_step() -> float:
|
88
|
+
return 5.0
|
89
|
+
|
90
|
+
|
91
|
+
@pytest.fixture
|
92
|
+
def relative_tolerance() -> float:
|
93
|
+
return 1.0e-15
|
94
|
+
|
95
|
+
|
96
|
+
@pytest.fixture
|
97
|
+
def absolute_tolerance() -> float:
|
98
|
+
return 1.0e-15
|
99
|
+
|
100
|
+
|
101
|
+
@pytest.fixture
|
102
|
+
def state_logger() -> callable:
|
103
|
+
def log_state(state: State) -> None:
|
104
|
+
print(state.get_coordinates())
|
105
|
+
|
106
|
+
return log_state
|
107
|
+
|
108
|
+
|
109
|
+
@pytest.fixture
|
110
|
+
def numerical_solver(
|
111
|
+
log_type: NumericalSolver.LogType,
|
112
|
+
variable_size_stepper_type: NumericalSolver.StepperType,
|
113
|
+
initial_time_step: float,
|
114
|
+
relative_tolerance: float,
|
115
|
+
absolute_tolerance: float,
|
116
|
+
) -> NumericalSolver:
|
117
|
+
return NumericalSolver(
|
118
|
+
log_type=log_type,
|
119
|
+
stepper_type=variable_size_stepper_type,
|
120
|
+
time_step=initial_time_step,
|
121
|
+
relative_tolerance=relative_tolerance,
|
122
|
+
absolute_tolerance=absolute_tolerance,
|
123
|
+
)
|
124
|
+
|
125
|
+
|
126
|
+
@pytest.fixture
|
127
|
+
def numerical_solver_conditional() -> NumericalSolver:
|
128
|
+
return NumericalSolver.default_conditional()
|
129
|
+
|
130
|
+
|
131
|
+
class TestNumericalSolver:
|
132
|
+
def test_constructors(self, numerical_solver: NumericalSolver):
|
133
|
+
assert numerical_solver is not None
|
134
|
+
assert isinstance(numerical_solver, NumericalSolver)
|
135
|
+
assert numerical_solver.is_defined()
|
136
|
+
|
137
|
+
def test_comparators(self, numerical_solver: NumericalSolver):
|
138
|
+
assert numerical_solver == numerical_solver
|
139
|
+
assert (numerical_solver != numerical_solver) is False
|
140
|
+
|
141
|
+
def test_get_types(
|
142
|
+
self,
|
143
|
+
log_type: NumericalSolver.LogType,
|
144
|
+
variable_size_stepper_type: NumericalSolver.StepperType,
|
145
|
+
initial_time_step: float,
|
146
|
+
relative_tolerance: float,
|
147
|
+
absolute_tolerance: float,
|
148
|
+
numerical_solver: NumericalSolver,
|
149
|
+
):
|
150
|
+
assert numerical_solver.get_log_type() == log_type
|
151
|
+
assert numerical_solver.get_stepper_type() == variable_size_stepper_type
|
152
|
+
assert numerical_solver.get_time_step() == initial_time_step
|
153
|
+
assert numerical_solver.get_relative_tolerance() == relative_tolerance
|
154
|
+
assert numerical_solver.get_absolute_tolerance() == absolute_tolerance
|
155
|
+
assert numerical_solver.get_root_solver() is not None
|
156
|
+
assert numerical_solver.get_observed_states() is not None
|
157
|
+
|
158
|
+
def test_get_string_from_types(self):
|
159
|
+
assert (
|
160
|
+
NumericalSolver.string_from_stepper_type(
|
161
|
+
NumericalSolver.StepperType.RungeKutta4
|
162
|
+
)
|
163
|
+
== "RungeKutta4"
|
164
|
+
)
|
165
|
+
assert (
|
166
|
+
NumericalSolver.string_from_stepper_type(
|
167
|
+
NumericalSolver.StepperType.RungeKuttaCashKarp54
|
168
|
+
)
|
169
|
+
== "RungeKuttaCashKarp54"
|
170
|
+
)
|
171
|
+
assert (
|
172
|
+
NumericalSolver.string_from_stepper_type(
|
173
|
+
NumericalSolver.StepperType.RungeKuttaFehlberg78
|
174
|
+
)
|
175
|
+
== "RungeKuttaFehlberg78"
|
176
|
+
)
|
177
|
+
assert (
|
178
|
+
NumericalSolver.string_from_log_type(NumericalSolver.LogType.NoLog) == "NoLog"
|
179
|
+
)
|
180
|
+
assert (
|
181
|
+
NumericalSolver.string_from_log_type(NumericalSolver.LogType.LogConstant)
|
182
|
+
== "LogConstant"
|
183
|
+
)
|
184
|
+
assert (
|
185
|
+
NumericalSolver.string_from_log_type(NumericalSolver.LogType.LogAdaptive)
|
186
|
+
== "LogAdaptive"
|
187
|
+
)
|
188
|
+
|
189
|
+
def test_integrate_time(
|
190
|
+
self,
|
191
|
+
initial_state: State,
|
192
|
+
numerical_solver: NumericalSolver,
|
193
|
+
):
|
194
|
+
duration_seconds: float = 100.0
|
195
|
+
end_instant: Instant = initial_state.get_instant() + Duration.seconds(
|
196
|
+
duration_seconds
|
197
|
+
)
|
198
|
+
|
199
|
+
state_vector: np.ndarray = numerical_solver.integrate_time(
|
200
|
+
initial_state, end_instant, oscillator
|
201
|
+
).get_coordinates()
|
202
|
+
|
203
|
+
assert 5e-9 >= abs(state_vector[0] - math.sin(duration_seconds))
|
204
|
+
assert 5e-9 >= abs(state_vector[1] - math.cos(duration_seconds))
|
205
|
+
|
206
|
+
end_instants: list[Instant] = [
|
207
|
+
initial_state.get_instant() + Duration.seconds(duration)
|
208
|
+
for duration in np.arange(600.0, 1000.0, 50.0)
|
209
|
+
]
|
210
|
+
states: list[State] = numerical_solver.integrate_time(
|
211
|
+
initial_state, end_instants, oscillator
|
212
|
+
)
|
213
|
+
|
214
|
+
for state, end_instant in zip(states, end_instants):
|
215
|
+
state_vector: np.ndarray = state.get_coordinates()
|
216
|
+
|
217
|
+
assert 5e-9 >= abs(
|
218
|
+
state_vector[0]
|
219
|
+
- math.sin((end_instant - initial_state.get_instant()).in_seconds())
|
220
|
+
)
|
221
|
+
assert 5e-9 >= abs(
|
222
|
+
state_vector[1]
|
223
|
+
- math.cos((end_instant - initial_state.get_instant()).in_seconds())
|
224
|
+
)
|
225
|
+
|
226
|
+
def test_integrate_time_with_condition(
|
227
|
+
self,
|
228
|
+
initial_state: State,
|
229
|
+
numerical_solver_conditional: NumericalSolver,
|
230
|
+
custom_condition: RealCondition,
|
231
|
+
):
|
232
|
+
end_time: float = initial_state.get_instant() + Duration.seconds(100.0)
|
233
|
+
|
234
|
+
condition_solution = numerical_solver_conditional.integrate_time(
|
235
|
+
initial_state, end_time, oscillator, custom_condition
|
236
|
+
)
|
237
|
+
|
238
|
+
assert condition_solution.condition_is_satisfied
|
239
|
+
assert (
|
240
|
+
condition_solution.iteration_count
|
241
|
+
< numerical_solver_conditional.get_root_solver().get_maximum_iteration_count()
|
242
|
+
)
|
243
|
+
assert condition_solution.root_solver_has_converged
|
244
|
+
|
245
|
+
state_vector = condition_solution.state.get_coordinates()
|
246
|
+
time = (
|
247
|
+
condition_solution.state.get_instant() - initial_state.get_instant()
|
248
|
+
).in_seconds()
|
249
|
+
|
250
|
+
assert abs(float(time - custom_condition.get_target().value)) < 1e-6
|
251
|
+
|
252
|
+
assert 5e-9 >= abs(state_vector[0] - math.sin(time))
|
253
|
+
assert 5e-9 >= abs(state_vector[1] - math.cos(time))
|
254
|
+
|
255
|
+
def test_integrate_conditional_with_logger(
|
256
|
+
self,
|
257
|
+
initial_state: State,
|
258
|
+
state_logger: callable,
|
259
|
+
custom_condition: RealCondition,
|
260
|
+
capsys,
|
261
|
+
):
|
262
|
+
numerical_solver: NumericalSolver = NumericalSolver.conditional(
|
263
|
+
5.0,
|
264
|
+
1.0e-15,
|
265
|
+
1.0e-15,
|
266
|
+
state_logger,
|
267
|
+
)
|
268
|
+
end_time: float = initial_state.get_instant() + Duration.seconds(10.0)
|
269
|
+
|
270
|
+
numerical_solver.integrate_time(
|
271
|
+
initial_state, end_time, oscillator, custom_condition
|
272
|
+
)
|
273
|
+
|
274
|
+
captured = capsys.readouterr()
|
275
|
+
|
276
|
+
assert captured.out != ""
|
277
|
+
|
278
|
+
def test_default(self):
|
279
|
+
assert NumericalSolver.default() is not None
|
280
|
+
|
281
|
+
def test_undefined(self):
|
282
|
+
assert NumericalSolver.undefined() is not None
|
283
|
+
assert NumericalSolver.undefined().is_defined() is False
|
284
|
+
|
285
|
+
def test_fixed_step_size(
|
286
|
+
self,
|
287
|
+
fixed_size_stepper_type: NumericalSolver.StepperType,
|
288
|
+
variable_size_stepper_type: NumericalSolver.StepperType,
|
289
|
+
initial_time_step: float,
|
290
|
+
):
|
291
|
+
assert (
|
292
|
+
NumericalSolver.fixed_step_size(fixed_size_stepper_type, initial_time_step)
|
293
|
+
is not None
|
294
|
+
)
|
295
|
+
with pytest.raises(Exception):
|
296
|
+
NumericalSolver.fixed_step_size(variable_size_stepper_type, initial_time_step)
|
297
|
+
|
298
|
+
def test_default_conditional(self, state_logger):
|
299
|
+
assert NumericalSolver.default_conditional() is not None
|
300
|
+
assert NumericalSolver.default_conditional(state_logger) is not None
|
301
|
+
|
302
|
+
def test_conditional(
|
303
|
+
self,
|
304
|
+
initial_time_step: float,
|
305
|
+
relative_tolerance: float,
|
306
|
+
absolute_tolerance: float,
|
307
|
+
state_logger,
|
308
|
+
):
|
309
|
+
assert (
|
310
|
+
NumericalSolver.conditional(
|
311
|
+
initial_time_step, relative_tolerance, absolute_tolerance, state_logger
|
312
|
+
)
|
313
|
+
is not None
|
314
|
+
)
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.physics.coordinate import Frame
|
6
|
+
|
7
|
+
from ostk.astrodynamics.trajectory import LocalOrbitalFrameFactory
|
8
|
+
from ostk.astrodynamics.trajectory import LocalOrbitalFrameDirection
|
9
|
+
|
10
|
+
|
11
|
+
@pytest.fixture
|
12
|
+
def local_orbital_frame_factory() -> LocalOrbitalFrameFactory:
|
13
|
+
return LocalOrbitalFrameFactory.VNC(Frame.GCRF())
|
14
|
+
|
15
|
+
|
16
|
+
@pytest.fixture
|
17
|
+
def direction_vector() -> list:
|
18
|
+
return [1.0, 0.0, 0.0]
|
19
|
+
|
20
|
+
|
21
|
+
@pytest.fixture
|
22
|
+
def local_orbital_frame_direction(
|
23
|
+
direction_vector: list,
|
24
|
+
local_orbital_frame_factory: LocalOrbitalFrameFactory,
|
25
|
+
) -> LocalOrbitalFrameDirection:
|
26
|
+
return LocalOrbitalFrameDirection(
|
27
|
+
vector=direction_vector,
|
28
|
+
local_orbital_frame_factory=local_orbital_frame_factory,
|
29
|
+
)
|
30
|
+
|
31
|
+
|
32
|
+
class TestLocalOrbitalFrameDirection:
|
33
|
+
def test_constructor(
|
34
|
+
self,
|
35
|
+
direction_vector: list,
|
36
|
+
local_orbital_frame_factory: LocalOrbitalFrameFactory,
|
37
|
+
):
|
38
|
+
local_orbital_frame_direction: LocalOrbitalFrameDirection = (
|
39
|
+
LocalOrbitalFrameDirection(
|
40
|
+
direction_vector,
|
41
|
+
local_orbital_frame_factory,
|
42
|
+
)
|
43
|
+
)
|
44
|
+
|
45
|
+
assert local_orbital_frame_direction is not None
|
46
|
+
assert isinstance(local_orbital_frame_direction, LocalOrbitalFrameDirection)
|
47
|
+
|
48
|
+
def test_equal_to_operator(
|
49
|
+
self, local_orbital_frame_direction: LocalOrbitalFrameDirection
|
50
|
+
):
|
51
|
+
assert local_orbital_frame_direction == local_orbital_frame_direction
|
52
|
+
assert local_orbital_frame_direction != LocalOrbitalFrameDirection(
|
53
|
+
[0.0, 1.0, 0.0],
|
54
|
+
local_orbital_frame_direction.get_local_orbital_frame_factory(),
|
55
|
+
)
|
56
|
+
|
57
|
+
def test_is_defined(
|
58
|
+
self,
|
59
|
+
local_orbital_frame_direction: LocalOrbitalFrameDirection,
|
60
|
+
):
|
61
|
+
assert local_orbital_frame_direction.is_defined()
|
62
|
+
|
63
|
+
def test_getters(
|
64
|
+
self,
|
65
|
+
local_orbital_frame_direction: LocalOrbitalFrameDirection,
|
66
|
+
direction_vector: list,
|
67
|
+
local_orbital_frame_factory: LocalOrbitalFrameFactory,
|
68
|
+
):
|
69
|
+
assert list(local_orbital_frame_direction.get_value()) == direction_vector
|
70
|
+
assert (
|
71
|
+
local_orbital_frame_direction.get_local_orbital_frame_factory()
|
72
|
+
== local_orbital_frame_factory
|
73
|
+
)
|
74
|
+
|
75
|
+
def test_undefined(
|
76
|
+
self,
|
77
|
+
):
|
78
|
+
local_orbital_frame_direction: LocalOrbitalFrameDirection = (
|
79
|
+
LocalOrbitalFrameDirection.undefined()
|
80
|
+
)
|
81
|
+
assert local_orbital_frame_direction.is_defined() is False
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.physics.time import Instant
|
6
|
+
from ostk.physics.time import DateTime
|
7
|
+
from ostk.physics.time import Scale
|
8
|
+
from ostk.physics.coordinate import Position
|
9
|
+
from ostk.physics.coordinate import Velocity
|
10
|
+
from ostk.physics.coordinate import Frame
|
11
|
+
|
12
|
+
from ostk.astrodynamics.trajectory import LocalOrbitalFrameFactory
|
13
|
+
|
14
|
+
|
15
|
+
@pytest.fixture
|
16
|
+
def local_orbital_frame_factory() -> LocalOrbitalFrameFactory:
|
17
|
+
return LocalOrbitalFrameFactory.VNC(Frame.GCRF())
|
18
|
+
|
19
|
+
|
20
|
+
@pytest.fixture
|
21
|
+
def instant() -> Instant:
|
22
|
+
return Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
23
|
+
|
24
|
+
|
25
|
+
@pytest.fixture
|
26
|
+
def position_vector() -> list:
|
27
|
+
return [7500000.0, 0.0, 0.0]
|
28
|
+
|
29
|
+
|
30
|
+
@pytest.fixture
|
31
|
+
def velocity_vector() -> list:
|
32
|
+
return [0.0, 5335.865450622126, 5335.865450622126]
|
33
|
+
|
34
|
+
|
35
|
+
class TestLocalOrbitalFrameFactory:
|
36
|
+
def test_constructors(self):
|
37
|
+
assert LocalOrbitalFrameFactory.VNC(Frame.GCRF()) is not None
|
38
|
+
assert LocalOrbitalFrameFactory.NED(Frame.GCRF()) is not None
|
39
|
+
assert LocalOrbitalFrameFactory.LVLH(Frame.GCRF()) is not None
|
40
|
+
assert LocalOrbitalFrameFactory.QSW(Frame.GCRF()) is not None
|
41
|
+
assert LocalOrbitalFrameFactory.TNW(Frame.GCRF()) is not None
|
42
|
+
assert LocalOrbitalFrameFactory.VVLH(Frame.GCRF()) is not None
|
43
|
+
|
44
|
+
def test_generate_frame(
|
45
|
+
self,
|
46
|
+
local_orbital_frame_factory: LocalOrbitalFrameFactory,
|
47
|
+
instant: Instant,
|
48
|
+
position_vector: list,
|
49
|
+
velocity_vector: list,
|
50
|
+
):
|
51
|
+
frame = local_orbital_frame_factory.generate_frame(
|
52
|
+
instant,
|
53
|
+
position_vector,
|
54
|
+
velocity_vector,
|
55
|
+
)
|
56
|
+
|
57
|
+
assert frame is not None
|
58
|
+
assert frame.is_defined()
|
59
|
+
|
60
|
+
def test_is_defined(
|
61
|
+
self,
|
62
|
+
local_orbital_frame_factory: LocalOrbitalFrameFactory,
|
63
|
+
):
|
64
|
+
assert local_orbital_frame_factory.is_defined()
|
@@ -0,0 +1 @@
|
|
1
|
+
# Apache License 2.0
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
from ostk.physics import Environment
|
6
|
+
from ostk.physics.units import Length, Angle
|
7
|
+
from ostk.physics.time import Scale, Instant, DateTime, Time
|
8
|
+
|
9
|
+
from ostk.astrodynamics.trajectory import Orbit, State
|
10
|
+
from ostk.astrodynamics.trajectory.orbit.models import SGP4
|
11
|
+
from ostk.astrodynamics.trajectory.orbit.models.sgp4 import TLE
|
12
|
+
|
13
|
+
|
14
|
+
@pytest.fixture
|
15
|
+
def earth():
|
16
|
+
return Environment.default().access_celestial_object_with_name("Earth")
|
17
|
+
|
18
|
+
|
19
|
+
class TestOrbit:
|
20
|
+
def test_trajectory_orbit_constructors(self, earth):
|
21
|
+
# Construct Two-Line Element set
|
22
|
+
tle = TLE(
|
23
|
+
"1 25544U 98067A 18231.17878740 .00000187 00000-0 10196-4 0 9994",
|
24
|
+
"2 25544 51.6447 64.7824 0005971 73.1467 36.4366 15.53848234128316",
|
25
|
+
)
|
26
|
+
|
27
|
+
# Construct orbit using SGP4 model
|
28
|
+
orbit = Orbit(SGP4(tle), earth)
|
29
|
+
|
30
|
+
assert orbit is not None
|
31
|
+
assert isinstance(orbit, Orbit)
|
32
|
+
assert orbit.is_defined()
|
33
|
+
|
34
|
+
# Construct get state at current epoch
|
35
|
+
state: State = orbit.get_state_at(Instant.now())
|
36
|
+
|
37
|
+
assert state is not None
|
38
|
+
assert isinstance(state, State)
|
39
|
+
|
40
|
+
def test_trajectory_orbit_circular(self, earth):
|
41
|
+
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
42
|
+
altitude = Length.kilometers(500.0)
|
43
|
+
inclination = Angle.degrees(45.0)
|
44
|
+
|
45
|
+
orbit: Orbit = Orbit.circular(epoch, altitude, inclination, earth)
|
46
|
+
|
47
|
+
def test_trajectory_orbit_equatorial(self, earth):
|
48
|
+
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
49
|
+
apoapsis_altitude = Length.kilometers(500.1)
|
50
|
+
periapsis_altitude = Length.kilometers(499.9)
|
51
|
+
|
52
|
+
orbit: Orbit = Orbit.equatorial(
|
53
|
+
epoch, apoapsis_altitude, periapsis_altitude, earth
|
54
|
+
)
|
55
|
+
|
56
|
+
assert orbit is not None
|
57
|
+
assert isinstance(orbit, Orbit)
|
58
|
+
assert orbit.is_defined()
|
59
|
+
|
60
|
+
def test_trajectory_orbit_circular_equatorial(self, earth):
|
61
|
+
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
62
|
+
altitude = Length.kilometers(500.0)
|
63
|
+
|
64
|
+
orbit: Orbit = Orbit.circular_equatorial(epoch, altitude, earth)
|
65
|
+
|
66
|
+
assert orbit is not None
|
67
|
+
assert isinstance(orbit, Orbit)
|
68
|
+
assert orbit.is_defined()
|
69
|
+
|
70
|
+
def test_trajectory_orbit_geo_synchronous(self, earth):
|
71
|
+
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
72
|
+
inclination = Angle.degrees(45.0)
|
73
|
+
longitude = Angle.degrees(45.0)
|
74
|
+
|
75
|
+
orbit: Orbit = Orbit.geo_synchronous(epoch, inclination, longitude, earth)
|
76
|
+
|
77
|
+
assert orbit is not None
|
78
|
+
assert isinstance(orbit, Orbit)
|
79
|
+
assert orbit.is_defined()
|
80
|
+
|
81
|
+
def test_trajectory_orbit_sun_synchronous(self, earth):
|
82
|
+
epoch = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
83
|
+
altitude = Length.kilometers(500.0)
|
84
|
+
local_time_at_descending_node = Time.midnight()
|
85
|
+
|
86
|
+
orbit: Orbit = Orbit.sun_synchronous(
|
87
|
+
epoch, altitude, local_time_at_descending_node, earth
|
88
|
+
)
|
89
|
+
|
90
|
+
assert orbit is not None
|
91
|
+
assert isinstance(orbit, Orbit)
|
92
|
+
assert orbit.is_defined()
|