open-space-toolkit-astrodynamics 17.2.0__py312-none-manylinux2014_x86_64.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-17.2.0.dist-info/METADATA +30 -0
- open_space_toolkit_astrodynamics-17.2.0.dist-info/RECORD +151 -0
- open_space_toolkit_astrodynamics-17.2.0.dist-info/WHEEL +5 -0
- open_space_toolkit_astrodynamics-17.2.0.dist-info/top_level.txt +1 -0
- open_space_toolkit_astrodynamics-17.2.0.dist-info/zip-safe +1 -0
- ostk/__init__.py +1 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-312-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/__init__.py +11 -0
- ostk/astrodynamics/__init__.pyi +720 -0
- ostk/astrodynamics/access.pyi +577 -0
- ostk/astrodynamics/conjunction/__init__.pyi +121 -0
- ostk/astrodynamics/conjunction/close_approach.pyi +89 -0
- ostk/astrodynamics/conjunction/message/__init__.pyi +3 -0
- ostk/astrodynamics/conjunction/message/ccsds.pyi +705 -0
- ostk/astrodynamics/converters.py +130 -0
- ostk/astrodynamics/converters.pyi +58 -0
- ostk/astrodynamics/data/__init__.pyi +3 -0
- ostk/astrodynamics/data/provider.pyi +22 -0
- ostk/astrodynamics/dataframe.py +597 -0
- ostk/astrodynamics/display.py +281 -0
- ostk/astrodynamics/dynamics.pyi +311 -0
- ostk/astrodynamics/eclipse.pyi +70 -0
- ostk/astrodynamics/estimator.pyi +268 -0
- ostk/astrodynamics/event_condition.pyi +910 -0
- ostk/astrodynamics/flight/__init__.pyi +626 -0
- ostk/astrodynamics/flight/profile/__init__.pyi +99 -0
- ostk/astrodynamics/flight/profile/model.pyi +179 -0
- ostk/astrodynamics/flight/system.pyi +268 -0
- ostk/astrodynamics/guidance_law.pyi +416 -0
- ostk/astrodynamics/libopen-space-toolkit-astrodynamics.so.17 +0 -0
- ostk/astrodynamics/pytrajectory/__init__.py +1 -0
- ostk/astrodynamics/pytrajectory/__init__.pyi +3 -0
- ostk/astrodynamics/pytrajectory/pystate.py +263 -0
- ostk/astrodynamics/pytrajectory/pystate.pyi +66 -0
- ostk/astrodynamics/solver.pyi +432 -0
- ostk/astrodynamics/test/__init__.py +1 -0
- ostk/astrodynamics/test/access/__init__.py +1 -0
- ostk/astrodynamics/test/access/test_generator.py +319 -0
- ostk/astrodynamics/test/access/test_visibility_criterion.py +201 -0
- ostk/astrodynamics/test/conftest.py +119 -0
- ostk/astrodynamics/test/conjunction/close_approach/__init__.py +0 -0
- ostk/astrodynamics/test/conjunction/close_approach/test_generator.py +228 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/__init__.py +1 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/conftest.py +325 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/data/cdm.json +303 -0
- ostk/astrodynamics/test/conjunction/message/ccsds/test_cdm.py +416 -0
- ostk/astrodynamics/test/conjunction/test_close_approach.py +244 -0
- ostk/astrodynamics/test/data/provider/test_off_nadir.py +58 -0
- ostk/astrodynamics/test/dynamics/__init__.py +1 -0
- ostk/astrodynamics/test/dynamics/data/Tabulated_Earth_Gravity.csv +565 -0
- ostk/astrodynamics/test/dynamics/data/Tabulated_Earth_Gravity_Truth.csv +100 -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_tabulated.py +138 -0
- ostk/astrodynamics/test/dynamics/test_third_body_gravity.py +67 -0
- ostk/astrodynamics/test/dynamics/test_thruster.py +157 -0
- ostk/astrodynamics/test/eclipse/__init__.py +1 -0
- ostk/astrodynamics/test/eclipse/test_generator.py +138 -0
- ostk/astrodynamics/test/estimator/test_orbit_determination_solver.py +261 -0
- ostk/astrodynamics/test/estimator/test_tle_solver.py +216 -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_brouwer_lyddane_mean_long_condition.py +135 -0
- ostk/astrodynamics/test/event_condition/test_coe_condition.py +135 -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/model/test_tabulated_profile.py +115 -0
- ostk/astrodynamics/test/flight/system/__init__.py +1 -0
- ostk/astrodynamics/test/flight/system/test_propulsion_system.py +64 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system.py +83 -0
- ostk/astrodynamics/test/flight/system/test_satellite_system_builder.py +71 -0
- ostk/astrodynamics/test/flight/test_maneuver.py +231 -0
- ostk/astrodynamics/test/flight/test_profile.py +293 -0
- ostk/astrodynamics/test/flight/test_system.py +45 -0
- ostk/astrodynamics/test/guidance_law/test_constant_thrust.py +177 -0
- ostk/astrodynamics/test/guidance_law/test_guidance_law.py +60 -0
- ostk/astrodynamics/test/guidance_law/test_heterogeneous_guidance_law.py +164 -0
- ostk/astrodynamics/test/guidance_law/test_qlaw.py +209 -0
- ostk/astrodynamics/test/solvers/__init__.py +1 -0
- ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +196 -0
- ostk/astrodynamics/test/solvers/test_least_squares_solver.py +334 -0
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +161 -0
- ostk/astrodynamics/test/test_access.py +128 -0
- ostk/astrodynamics/test/test_converters.py +290 -0
- ostk/astrodynamics/test/test_dataframe.py +1355 -0
- ostk/astrodynamics/test/test_display.py +184 -0
- ostk/astrodynamics/test/test_event_condition.py +80 -0
- ostk/astrodynamics/test/test_import.py +26 -0
- ostk/astrodynamics/test/test_root_solver.py +70 -0
- ostk/astrodynamics/test/test_trajectory.py +126 -0
- ostk/astrodynamics/test/test_utilities.py +338 -0
- ostk/astrodynamics/test/test_viewer.py +318 -0
- ostk/astrodynamics/test/trajectory/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/model/test_nadir_trajectory.py +87 -0
- ostk/astrodynamics/test/trajectory/model/test_tabulated_trajectory.py +303 -0
- ostk/astrodynamics/test/trajectory/model/test_target_scan_trajectory.py +126 -0
- ostk/astrodynamics/test/trajectory/orbit/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/conftest.py +18 -0
- ostk/astrodynamics/test/trajectory/orbit/message/spacex/data/opm_1.yaml +44 -0
- ostk/astrodynamics/test/trajectory/orbit/message/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 +305 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +1 -0
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +337 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +130 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_modified_equinoctial.py +142 -0
- ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +234 -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 +75 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_angular_velocity.py +30 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_attitude_quaternion.py +18 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_acceleration.py +136 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_position.py +107 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_velocity.py +115 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinate_broker.py +84 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinate_subset.py +58 -0
- ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +316 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +81 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +119 -0
- ostk/astrodynamics/test/trajectory/test_model.py +1 -0
- ostk/astrodynamics/test/trajectory/test_orbit.py +212 -0
- ostk/astrodynamics/test/trajectory/test_propagator.py +452 -0
- ostk/astrodynamics/test/trajectory/test_segment.py +694 -0
- ostk/astrodynamics/test/trajectory/test_sequence.py +550 -0
- ostk/astrodynamics/test/trajectory/test_state.py +629 -0
- ostk/astrodynamics/test/trajectory/test_state_builder.py +172 -0
- ostk/astrodynamics/trajectory/__init__.pyi +1982 -0
- ostk/astrodynamics/trajectory/model.pyi +259 -0
- ostk/astrodynamics/trajectory/orbit/__init__.pyi +349 -0
- ostk/astrodynamics/trajectory/orbit/message/__init__.pyi +3 -0
- ostk/astrodynamics/trajectory/orbit/message/spacex.pyi +264 -0
- ostk/astrodynamics/trajectory/orbit/model/__init__.pyi +648 -0
- ostk/astrodynamics/trajectory/orbit/model/brouwerLyddaneMean.pyi +121 -0
- ostk/astrodynamics/trajectory/orbit/model/kepler.pyi +709 -0
- ostk/astrodynamics/trajectory/orbit/model/sgp4.pyi +330 -0
- ostk/astrodynamics/trajectory/state/__init__.pyi +402 -0
- ostk/astrodynamics/trajectory/state/coordinate_subset.pyi +208 -0
- ostk/astrodynamics/utilities.py +396 -0
- ostk/astrodynamics/viewer.py +851 -0
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
import numpy as np
|
|
5
|
+
|
|
6
|
+
from ostk.physics import Environment
|
|
7
|
+
from ostk.physics.time import Instant
|
|
8
|
+
from ostk.physics.time import DateTime
|
|
9
|
+
from ostk.physics.time import Scale
|
|
10
|
+
from ostk.physics.time import Duration
|
|
11
|
+
from ostk.physics.time import Interval
|
|
12
|
+
from ostk.physics.coordinate import Frame
|
|
13
|
+
from ostk.physics.environment.object.celestial import Earth
|
|
14
|
+
from ostk.physics.unit import Angle
|
|
15
|
+
|
|
16
|
+
from ostk.astrodynamics.flight.system import SatelliteSystem
|
|
17
|
+
from ostk.astrodynamics import Dynamics
|
|
18
|
+
from ostk.astrodynamics.dynamics import CentralBodyGravity
|
|
19
|
+
from ostk.astrodynamics.dynamics import PositionDerivative
|
|
20
|
+
from ostk.astrodynamics.dynamics import Thruster
|
|
21
|
+
from ostk.astrodynamics.guidance_law import ConstantThrust
|
|
22
|
+
from ostk.astrodynamics.trajectory import LocalOrbitalFrameFactory
|
|
23
|
+
from ostk.astrodynamics.trajectory import State
|
|
24
|
+
from ostk.astrodynamics.trajectory import Segment
|
|
25
|
+
from ostk.astrodynamics.event_condition import InstantCondition
|
|
26
|
+
from ostk.astrodynamics.trajectory.state import CoordinateSubset
|
|
27
|
+
from ostk.astrodynamics.trajectory.state import CoordinateBroker
|
|
28
|
+
from ostk.astrodynamics.trajectory.state.coordinate_subset import CartesianPosition
|
|
29
|
+
from ostk.astrodynamics.trajectory.state.coordinate_subset import CartesianVelocity
|
|
30
|
+
from ostk.astrodynamics.trajectory.state import NumericalSolver
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@pytest.fixture
|
|
34
|
+
def environment() -> Environment:
|
|
35
|
+
return Environment.default()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.fixture
|
|
39
|
+
def state() -> State:
|
|
40
|
+
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
|
41
|
+
coordinates: list[float] = [
|
|
42
|
+
7500000.0,
|
|
43
|
+
0.0,
|
|
44
|
+
0.0,
|
|
45
|
+
0.0,
|
|
46
|
+
5335.865450622126,
|
|
47
|
+
5335.865450622126,
|
|
48
|
+
300.0,
|
|
49
|
+
]
|
|
50
|
+
frame: Frame = Frame.GCRF()
|
|
51
|
+
coordinate_broker: CoordinateBroker = CoordinateBroker(
|
|
52
|
+
[
|
|
53
|
+
CartesianPosition.default(),
|
|
54
|
+
CartesianVelocity.default(),
|
|
55
|
+
CoordinateSubset.mass(),
|
|
56
|
+
]
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
return State(instant, coordinates, frame, coordinate_broker)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@pytest.fixture
|
|
63
|
+
def state_2() -> State:
|
|
64
|
+
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 1, 0, 0), Scale.UTC)
|
|
65
|
+
coordinates: list[float] = [7500000.0, 0.0, 0.0, 0.0, 5335.865450622126, 0.0, 300.0]
|
|
66
|
+
frame: Frame = Frame.GCRF()
|
|
67
|
+
coordinate_broker: CoordinateBroker = CoordinateBroker(
|
|
68
|
+
[
|
|
69
|
+
CartesianPosition.default(),
|
|
70
|
+
CartesianVelocity.default(),
|
|
71
|
+
CoordinateSubset.mass(),
|
|
72
|
+
]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
return State(instant, coordinates, frame, coordinate_broker)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@pytest.fixture
|
|
79
|
+
def states(state: State, state_2: State) -> list[State]:
|
|
80
|
+
return [state, state_2]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@pytest.fixture
|
|
84
|
+
def central_body_gravity() -> CentralBodyGravity:
|
|
85
|
+
return CentralBodyGravity(Earth.spherical())
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@pytest.fixture
|
|
89
|
+
def position_derivative() -> PositionDerivative:
|
|
90
|
+
return PositionDerivative()
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@pytest.fixture
|
|
94
|
+
def dynamics(
|
|
95
|
+
position_derivative: PositionDerivative,
|
|
96
|
+
central_body_gravity: CentralBodyGravity,
|
|
97
|
+
) -> list:
|
|
98
|
+
return [
|
|
99
|
+
position_derivative,
|
|
100
|
+
central_body_gravity,
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@pytest.fixture
|
|
105
|
+
def local_orbital_frame_factory() -> LocalOrbitalFrameFactory:
|
|
106
|
+
return LocalOrbitalFrameFactory.VNC(Frame.GCRF())
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@pytest.fixture
|
|
110
|
+
def numerical_solver() -> NumericalSolver:
|
|
111
|
+
return NumericalSolver.default_conditional()
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@pytest.fixture
|
|
115
|
+
def end_instant(state: State) -> Instant:
|
|
116
|
+
return state.get_instant() + Duration.minutes(15.0)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
@pytest.fixture
|
|
120
|
+
def interval(state: State) -> Interval:
|
|
121
|
+
return Interval.closed(
|
|
122
|
+
state.get_instant(), state.get_instant() + Duration.minutes(10.0)
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@pytest.fixture
|
|
127
|
+
def instant_condition(end_instant: Instant) -> InstantCondition:
|
|
128
|
+
return InstantCondition(InstantCondition.Criterion.AnyCrossing, end_instant)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@pytest.fixture
|
|
132
|
+
def name() -> str:
|
|
133
|
+
return "A Segment"
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@pytest.fixture
|
|
137
|
+
def coast_duration_segment(
|
|
138
|
+
name: str,
|
|
139
|
+
instant_condition: InstantCondition,
|
|
140
|
+
dynamics: list,
|
|
141
|
+
numerical_solver: NumericalSolver,
|
|
142
|
+
) -> Segment:
|
|
143
|
+
return Segment.coast(name, instant_condition, dynamics, numerical_solver)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@pytest.fixture
|
|
147
|
+
def maneuver_constraints() -> Segment.ManeuverConstraints:
|
|
148
|
+
return Segment.ManeuverConstraints(
|
|
149
|
+
minimum_duration=Duration.minutes(1.0),
|
|
150
|
+
maximum_duration=Duration.minutes(10.0),
|
|
151
|
+
minimum_separation=Duration.minutes(5.0),
|
|
152
|
+
maximum_duration_strategy=Segment.MaximumManeuverDurationViolationStrategy.Skip,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
@pytest.fixture
|
|
157
|
+
def maneuver_segment(
|
|
158
|
+
name: str,
|
|
159
|
+
instant_condition: InstantCondition,
|
|
160
|
+
dynamics: list,
|
|
161
|
+
numerical_solver: NumericalSolver,
|
|
162
|
+
thruster_dynamics: Thruster,
|
|
163
|
+
) -> Segment:
|
|
164
|
+
return Segment.maneuver(
|
|
165
|
+
name=name,
|
|
166
|
+
event_condition=instant_condition,
|
|
167
|
+
thruster_dynamics=thruster_dynamics,
|
|
168
|
+
dynamics=dynamics,
|
|
169
|
+
numerical_solver=numerical_solver,
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@pytest.fixture
|
|
174
|
+
def maximum_allowed_angular_offset() -> Angle:
|
|
175
|
+
return Angle.degrees(180.0)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@pytest.fixture
|
|
179
|
+
def constant_local_orbital_frame_direction_maneuver_segment(
|
|
180
|
+
name: str,
|
|
181
|
+
instant_condition: InstantCondition,
|
|
182
|
+
thruster_dynamics: Thruster,
|
|
183
|
+
dynamics: list,
|
|
184
|
+
numerical_solver: NumericalSolver,
|
|
185
|
+
local_orbital_frame_factory: LocalOrbitalFrameFactory,
|
|
186
|
+
) -> Segment:
|
|
187
|
+
return Segment.constant_local_orbital_frame_direction_maneuver(
|
|
188
|
+
name=name,
|
|
189
|
+
event_condition=instant_condition,
|
|
190
|
+
thruster_dynamics=thruster_dynamics,
|
|
191
|
+
dynamics=dynamics,
|
|
192
|
+
numerical_solver=numerical_solver,
|
|
193
|
+
local_orbital_frame_factory=local_orbital_frame_factory,
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
@pytest.fixture
|
|
198
|
+
def constant_local_orbital_frame_direction_maneuver_segment_with_maximum_allowed_angular_offset(
|
|
199
|
+
name: str,
|
|
200
|
+
instant_condition: InstantCondition,
|
|
201
|
+
thruster_dynamics: Thruster,
|
|
202
|
+
dynamics: list,
|
|
203
|
+
numerical_solver: NumericalSolver,
|
|
204
|
+
local_orbital_frame_factory: LocalOrbitalFrameFactory,
|
|
205
|
+
maximum_allowed_angular_offset: Angle,
|
|
206
|
+
) -> Segment:
|
|
207
|
+
return Segment.constant_local_orbital_frame_direction_maneuver(
|
|
208
|
+
name=name,
|
|
209
|
+
event_condition=instant_condition,
|
|
210
|
+
thruster_dynamics=thruster_dynamics,
|
|
211
|
+
dynamics=dynamics,
|
|
212
|
+
numerical_solver=numerical_solver,
|
|
213
|
+
local_orbital_frame_factory=local_orbital_frame_factory,
|
|
214
|
+
maximum_allowed_angular_offset=maximum_allowed_angular_offset,
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@pytest.fixture
|
|
219
|
+
def instants(state: State) -> list[Instant]:
|
|
220
|
+
return [state.get_instant(), state.get_instant() + Duration.minutes(1.0)]
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
@pytest.fixture
|
|
224
|
+
def thruster_dynamics() -> Thruster:
|
|
225
|
+
return Thruster(
|
|
226
|
+
satellite_system=SatelliteSystem.default(),
|
|
227
|
+
guidance_law=ConstantThrust.intrack(),
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
@pytest.fixture
|
|
232
|
+
def segment_solution(
|
|
233
|
+
dynamics: list[Dynamics],
|
|
234
|
+
state: State,
|
|
235
|
+
) -> Segment.Solution:
|
|
236
|
+
return Segment.Solution(
|
|
237
|
+
name="A Segment Solution",
|
|
238
|
+
dynamics=dynamics,
|
|
239
|
+
states=[
|
|
240
|
+
state,
|
|
241
|
+
],
|
|
242
|
+
condition_is_satisfied=True,
|
|
243
|
+
segment_type=Segment.Type.Coast,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@pytest.fixture
|
|
248
|
+
def maneuver_segment_solution(
|
|
249
|
+
dynamics: list[Dynamics],
|
|
250
|
+
thruster_dynamics: Thruster,
|
|
251
|
+
states: list[State],
|
|
252
|
+
) -> Segment.Solution:
|
|
253
|
+
return Segment.Solution(
|
|
254
|
+
name="A Maneuver Segment Solution",
|
|
255
|
+
dynamics=dynamics + [thruster_dynamics],
|
|
256
|
+
states=states,
|
|
257
|
+
condition_is_satisfied=True,
|
|
258
|
+
segment_type=Segment.Type.Maneuver,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class TestSegmentSolution:
|
|
263
|
+
def test_constructors(
|
|
264
|
+
self,
|
|
265
|
+
segment_solution: Segment.Solution,
|
|
266
|
+
):
|
|
267
|
+
assert segment_solution is not None
|
|
268
|
+
assert segment_solution.name is not None
|
|
269
|
+
assert segment_solution.dynamics is not None
|
|
270
|
+
assert segment_solution.states is not None
|
|
271
|
+
assert segment_solution.condition_is_satisfied is not None
|
|
272
|
+
assert segment_solution.segment_type is not None
|
|
273
|
+
|
|
274
|
+
def test_getters_and_accessors(
|
|
275
|
+
self,
|
|
276
|
+
segment_solution: Segment.Solution,
|
|
277
|
+
):
|
|
278
|
+
assert segment_solution.access_start_instant() is not None
|
|
279
|
+
assert segment_solution.access_end_instant() is not None
|
|
280
|
+
assert segment_solution.get_interval() is not None
|
|
281
|
+
assert segment_solution.get_initial_mass() is not None
|
|
282
|
+
assert segment_solution.get_final_mass() is not None
|
|
283
|
+
assert segment_solution.get_propagation_duration() is not None
|
|
284
|
+
|
|
285
|
+
def test_compute_delta_v(
|
|
286
|
+
self,
|
|
287
|
+
segment_solution: Segment.Solution,
|
|
288
|
+
):
|
|
289
|
+
assert segment_solution.compute_delta_v(1500.0) is not None
|
|
290
|
+
|
|
291
|
+
def test_compute_delta_mass(
|
|
292
|
+
self,
|
|
293
|
+
segment_solution: Segment.Solution,
|
|
294
|
+
):
|
|
295
|
+
assert segment_solution.compute_delta_mass() is not None
|
|
296
|
+
|
|
297
|
+
def test_get_thruster_dynamics(
|
|
298
|
+
self,
|
|
299
|
+
maneuver_segment_solution: Segment.Solution,
|
|
300
|
+
thruster_dynamics: Thruster,
|
|
301
|
+
):
|
|
302
|
+
assert maneuver_segment_solution.get_thruster_dynamics() == thruster_dynamics
|
|
303
|
+
|
|
304
|
+
def test_extract_maneuvers(
|
|
305
|
+
self,
|
|
306
|
+
maneuver_segment_solution: Segment.Solution,
|
|
307
|
+
):
|
|
308
|
+
assert maneuver_segment_solution.extract_maneuvers(Frame.GCRF()) is not None
|
|
309
|
+
|
|
310
|
+
def test_calculate_states_at(
|
|
311
|
+
self,
|
|
312
|
+
segment_solution: Segment.Solution,
|
|
313
|
+
):
|
|
314
|
+
assert (
|
|
315
|
+
segment_solution.calculate_states_at(
|
|
316
|
+
[
|
|
317
|
+
segment_solution.states[0].get_instant(),
|
|
318
|
+
],
|
|
319
|
+
NumericalSolver.default_conditional(),
|
|
320
|
+
)
|
|
321
|
+
is not None
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
def test_get_dynamics_contribution(
|
|
325
|
+
self,
|
|
326
|
+
segment_solution: Segment.Solution,
|
|
327
|
+
):
|
|
328
|
+
assert (
|
|
329
|
+
segment_solution.get_dynamics_contribution(
|
|
330
|
+
dynamics=segment_solution.dynamics[1],
|
|
331
|
+
frame=Frame.GCRF(),
|
|
332
|
+
coordinate_subsets=[CartesianVelocity.default()],
|
|
333
|
+
)
|
|
334
|
+
is not None
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
assert (
|
|
338
|
+
segment_solution.get_dynamics_contribution(
|
|
339
|
+
dynamics=segment_solution.dynamics[1],
|
|
340
|
+
frame=Frame.GCRF(),
|
|
341
|
+
)
|
|
342
|
+
is not None
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
def test_get_dynamics_acceleration_contribution(
|
|
346
|
+
self,
|
|
347
|
+
segment_solution: Segment.Solution,
|
|
348
|
+
):
|
|
349
|
+
assert (
|
|
350
|
+
segment_solution.get_dynamics_acceleration_contribution(
|
|
351
|
+
dynamics=segment_solution.dynamics[1], frame=Frame.GCRF()
|
|
352
|
+
)
|
|
353
|
+
is not None
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
def test_get_all_dynamics_contributions(
|
|
357
|
+
self,
|
|
358
|
+
segment_solution: Segment.Solution,
|
|
359
|
+
):
|
|
360
|
+
assert segment_solution.get_all_dynamics_contributions(Frame.GCRF()) is not None
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
class TestSegment:
|
|
364
|
+
def test_get_name(self, coast_duration_segment: Segment, name: str):
|
|
365
|
+
assert coast_duration_segment.get_name() == name
|
|
366
|
+
|
|
367
|
+
def test_get_event_condition(
|
|
368
|
+
self,
|
|
369
|
+
instant_condition: InstantCondition,
|
|
370
|
+
coast_duration_segment: Segment,
|
|
371
|
+
):
|
|
372
|
+
assert coast_duration_segment.get_event_condition() == instant_condition
|
|
373
|
+
|
|
374
|
+
def test_get_dynamics(
|
|
375
|
+
self,
|
|
376
|
+
dynamics: list,
|
|
377
|
+
coast_duration_segment: Segment,
|
|
378
|
+
):
|
|
379
|
+
assert len(coast_duration_segment.get_dynamics()) == len(dynamics)
|
|
380
|
+
|
|
381
|
+
def test_get_free_dynamics(
|
|
382
|
+
self,
|
|
383
|
+
dynamics: list,
|
|
384
|
+
coast_duration_segment: Segment,
|
|
385
|
+
maneuver_segment: Segment,
|
|
386
|
+
):
|
|
387
|
+
assert len(coast_duration_segment.get_free_dynamics()) == len(dynamics)
|
|
388
|
+
assert len(maneuver_segment.get_free_dynamics()) == len(dynamics)
|
|
389
|
+
|
|
390
|
+
def test_get_numerical_solver(
|
|
391
|
+
self,
|
|
392
|
+
numerical_solver: NumericalSolver,
|
|
393
|
+
coast_duration_segment: Segment,
|
|
394
|
+
):
|
|
395
|
+
assert coast_duration_segment.get_numerical_solver() == numerical_solver
|
|
396
|
+
|
|
397
|
+
def test_get_thruster_dynamics(
|
|
398
|
+
self,
|
|
399
|
+
thruster_dynamics: Thruster,
|
|
400
|
+
maneuver_segment: Segment,
|
|
401
|
+
):
|
|
402
|
+
assert maneuver_segment.get_thruster_dynamics() == thruster_dynamics
|
|
403
|
+
|
|
404
|
+
def test_get_type(
|
|
405
|
+
self,
|
|
406
|
+
coast_duration_segment: Segment,
|
|
407
|
+
):
|
|
408
|
+
assert coast_duration_segment.get_type() == Segment.Type.Coast
|
|
409
|
+
|
|
410
|
+
def test_get_maneuver_constraints(
|
|
411
|
+
self,
|
|
412
|
+
maneuver_segment: Segment,
|
|
413
|
+
):
|
|
414
|
+
constraints = maneuver_segment.get_maneuver_constraints()
|
|
415
|
+
assert constraints is not None
|
|
416
|
+
assert isinstance(constraints, Segment.ManeuverConstraints)
|
|
417
|
+
|
|
418
|
+
def test_coast(
|
|
419
|
+
self,
|
|
420
|
+
name: str,
|
|
421
|
+
instant_condition: InstantCondition,
|
|
422
|
+
dynamics: list,
|
|
423
|
+
numerical_solver: NumericalSolver,
|
|
424
|
+
):
|
|
425
|
+
assert (
|
|
426
|
+
Segment.coast(name, instant_condition, dynamics, numerical_solver) is not None
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
def test_maneuver(
|
|
430
|
+
self,
|
|
431
|
+
name: str,
|
|
432
|
+
instant_condition: InstantCondition,
|
|
433
|
+
thruster_dynamics: Thruster,
|
|
434
|
+
dynamics: list,
|
|
435
|
+
numerical_solver: NumericalSolver,
|
|
436
|
+
):
|
|
437
|
+
assert (
|
|
438
|
+
Segment.maneuver(
|
|
439
|
+
name=name,
|
|
440
|
+
event_condition=instant_condition,
|
|
441
|
+
thruster_dynamics=thruster_dynamics,
|
|
442
|
+
dynamics=dynamics,
|
|
443
|
+
numerical_solver=numerical_solver,
|
|
444
|
+
)
|
|
445
|
+
is not None
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
# Test with maneuver constraints
|
|
449
|
+
constraints = Segment.ManeuverConstraints(
|
|
450
|
+
maximum_duration=Duration.minutes(10.0),
|
|
451
|
+
minimum_separation=Duration.minutes(5.0),
|
|
452
|
+
)
|
|
453
|
+
assert (
|
|
454
|
+
Segment.maneuver(
|
|
455
|
+
name=name,
|
|
456
|
+
event_condition=instant_condition,
|
|
457
|
+
thruster_dynamics=thruster_dynamics,
|
|
458
|
+
dynamics=dynamics,
|
|
459
|
+
numerical_solver=numerical_solver,
|
|
460
|
+
maneuver_constraints=constraints,
|
|
461
|
+
)
|
|
462
|
+
is not None
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
def test_constant_local_orbital_frame_direction_maneuver(
|
|
466
|
+
self,
|
|
467
|
+
name: str,
|
|
468
|
+
instant_condition: InstantCondition,
|
|
469
|
+
thruster_dynamics: Thruster,
|
|
470
|
+
dynamics: list,
|
|
471
|
+
numerical_solver: NumericalSolver,
|
|
472
|
+
local_orbital_frame_factory: LocalOrbitalFrameFactory,
|
|
473
|
+
maximum_allowed_angular_offset: Angle,
|
|
474
|
+
):
|
|
475
|
+
assert (
|
|
476
|
+
Segment.constant_local_orbital_frame_direction_maneuver(
|
|
477
|
+
name=name,
|
|
478
|
+
event_condition=instant_condition,
|
|
479
|
+
thruster_dynamics=thruster_dynamics,
|
|
480
|
+
dynamics=dynamics,
|
|
481
|
+
numerical_solver=numerical_solver,
|
|
482
|
+
local_orbital_frame_factory=local_orbital_frame_factory,
|
|
483
|
+
)
|
|
484
|
+
is not None
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
assert (
|
|
488
|
+
Segment.constant_local_orbital_frame_direction_maneuver(
|
|
489
|
+
name=name,
|
|
490
|
+
event_condition=instant_condition,
|
|
491
|
+
thruster_dynamics=thruster_dynamics,
|
|
492
|
+
dynamics=dynamics,
|
|
493
|
+
numerical_solver=numerical_solver,
|
|
494
|
+
local_orbital_frame_factory=local_orbital_frame_factory,
|
|
495
|
+
maximum_allowed_angular_offset=maximum_allowed_angular_offset,
|
|
496
|
+
)
|
|
497
|
+
is not None
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
# Test with maneuver constraints
|
|
501
|
+
constraints = Segment.ManeuverConstraints(
|
|
502
|
+
maximum_duration=Duration.minutes(10.0),
|
|
503
|
+
minimum_separation=Duration.minutes(5.0),
|
|
504
|
+
)
|
|
505
|
+
assert (
|
|
506
|
+
Segment.constant_local_orbital_frame_direction_maneuver(
|
|
507
|
+
name=name,
|
|
508
|
+
event_condition=instant_condition,
|
|
509
|
+
thruster_dynamics=thruster_dynamics,
|
|
510
|
+
dynamics=dynamics,
|
|
511
|
+
numerical_solver=numerical_solver,
|
|
512
|
+
local_orbital_frame_factory=local_orbital_frame_factory,
|
|
513
|
+
maximum_allowed_angular_offset=maximum_allowed_angular_offset,
|
|
514
|
+
maneuver_constraints=constraints,
|
|
515
|
+
)
|
|
516
|
+
is not None
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
def test_create_solution(
|
|
520
|
+
self,
|
|
521
|
+
dynamics: list,
|
|
522
|
+
state: State,
|
|
523
|
+
):
|
|
524
|
+
segment_solution: Segment.Solution = Segment.Solution(
|
|
525
|
+
name="A Segment",
|
|
526
|
+
dynamics=dynamics,
|
|
527
|
+
states=[
|
|
528
|
+
state,
|
|
529
|
+
],
|
|
530
|
+
condition_is_satisfied=True,
|
|
531
|
+
segment_type=Segment.Type.Coast,
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
assert segment_solution is not None
|
|
535
|
+
|
|
536
|
+
def test_solve_maneuver_segment(
|
|
537
|
+
self,
|
|
538
|
+
state: State,
|
|
539
|
+
end_instant: Instant,
|
|
540
|
+
maneuver_segment: Segment,
|
|
541
|
+
instants: list[Instant],
|
|
542
|
+
numerical_solver: NumericalSolver,
|
|
543
|
+
):
|
|
544
|
+
solution: Segment.Solution = maneuver_segment.solve(state)
|
|
545
|
+
|
|
546
|
+
assert (
|
|
547
|
+
pytest.approx(
|
|
548
|
+
float((solution.states[-1].get_instant() - end_instant).in_seconds()),
|
|
549
|
+
abs=1e-7,
|
|
550
|
+
)
|
|
551
|
+
== 0.0
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
assert solution.name is not None
|
|
555
|
+
assert solution.dynamics is not None
|
|
556
|
+
assert len(solution.states) > 0
|
|
557
|
+
assert solution.condition_is_satisfied is True
|
|
558
|
+
assert solution.segment_type is not None
|
|
559
|
+
|
|
560
|
+
assert solution.access_start_instant() is not None
|
|
561
|
+
assert solution.access_end_instant() is not None
|
|
562
|
+
|
|
563
|
+
assert solution.get_initial_mass() is not None
|
|
564
|
+
assert solution.get_final_mass() is not None
|
|
565
|
+
assert solution.get_propagation_duration() is not None
|
|
566
|
+
|
|
567
|
+
assert solution.compute_delta_v(1500.0) is not None
|
|
568
|
+
assert solution.compute_delta_mass() is not None
|
|
569
|
+
|
|
570
|
+
assert solution.extract_maneuvers(state.get_frame()) is not None
|
|
571
|
+
assert len(solution.extract_maneuvers(state.get_frame())) == 1
|
|
572
|
+
|
|
573
|
+
propagated_states = solution.calculate_states_at(
|
|
574
|
+
instants,
|
|
575
|
+
numerical_solver,
|
|
576
|
+
)
|
|
577
|
+
|
|
578
|
+
assert propagated_states is not None
|
|
579
|
+
assert len(propagated_states) == len(instants)
|
|
580
|
+
|
|
581
|
+
first_dynamics_contribution = solution.get_dynamics_contribution(
|
|
582
|
+
solution.dynamics[0], state.get_frame()
|
|
583
|
+
)
|
|
584
|
+
|
|
585
|
+
second_dynamics_contribution = solution.get_dynamics_contribution(
|
|
586
|
+
solution.dynamics[1], state.get_frame()
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
third_dynamics_contribution = solution.get_dynamics_contribution(
|
|
590
|
+
solution.dynamics[2], state.get_frame()
|
|
591
|
+
)
|
|
592
|
+
|
|
593
|
+
assert first_dynamics_contribution is not None
|
|
594
|
+
assert second_dynamics_contribution is not None
|
|
595
|
+
assert third_dynamics_contribution is not None
|
|
596
|
+
assert first_dynamics_contribution.shape == (len(solution.states), 3)
|
|
597
|
+
assert second_dynamics_contribution.shape == (len(solution.states), 3)
|
|
598
|
+
assert third_dynamics_contribution.shape == (len(solution.states), 4)
|
|
599
|
+
|
|
600
|
+
all_contributions = solution.get_all_dynamics_contributions(state.get_frame())
|
|
601
|
+
assert len(all_contributions) == len(solution.dynamics)
|
|
602
|
+
|
|
603
|
+
assert all_contributions is not None
|
|
604
|
+
assert isinstance(all_contributions, dict)
|
|
605
|
+
assert np.array_equal(
|
|
606
|
+
all_contributions[solution.dynamics[0]], first_dynamics_contribution
|
|
607
|
+
)
|
|
608
|
+
assert np.array_equal(
|
|
609
|
+
all_contributions[solution.dynamics[1]], second_dynamics_contribution
|
|
610
|
+
)
|
|
611
|
+
assert np.array_equal(
|
|
612
|
+
all_contributions[solution.dynamics[2]], third_dynamics_contribution
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
acceleration_contribution = solution.get_dynamics_acceleration_contribution(
|
|
616
|
+
solution.dynamics[1], state.get_frame()
|
|
617
|
+
)
|
|
618
|
+
assert acceleration_contribution is not None
|
|
619
|
+
assert acceleration_contribution.shape == (len(solution.states), 3)
|
|
620
|
+
assert isinstance(acceleration_contribution, np.ndarray)
|
|
621
|
+
|
|
622
|
+
with pytest.raises(Exception):
|
|
623
|
+
solution.get_dynamics_acceleration_contribution(
|
|
624
|
+
solution.dynamics[0], state.get_frame()
|
|
625
|
+
)
|
|
626
|
+
|
|
627
|
+
def test_solve_with_previous_maneuver_interval(
|
|
628
|
+
self,
|
|
629
|
+
state: State,
|
|
630
|
+
maneuver_segment: Segment,
|
|
631
|
+
instants: list[Instant],
|
|
632
|
+
):
|
|
633
|
+
solution: Segment.Solution = maneuver_segment.solve(
|
|
634
|
+
state=state,
|
|
635
|
+
maximum_propagation_duration=Duration.minutes(15.0),
|
|
636
|
+
previous_maneuver_interval=Interval.closed(instants[0], instants[1]),
|
|
637
|
+
)
|
|
638
|
+
|
|
639
|
+
assert solution is not None
|
|
640
|
+
|
|
641
|
+
def test_solve_constant_local_orbital_frame_direction_maneuver_segment(
|
|
642
|
+
self,
|
|
643
|
+
state: State,
|
|
644
|
+
constant_local_orbital_frame_direction_maneuver_segment: Segment,
|
|
645
|
+
constant_local_orbital_frame_direction_maneuver_segment_with_maximum_allowed_angular_offset: Segment,
|
|
646
|
+
):
|
|
647
|
+
solution: Segment.Solution = (
|
|
648
|
+
constant_local_orbital_frame_direction_maneuver_segment.solve(state)
|
|
649
|
+
)
|
|
650
|
+
assert solution is not None
|
|
651
|
+
|
|
652
|
+
solution_with_maximum_allowed_angular_offset: Segment.Solution = (
|
|
653
|
+
constant_local_orbital_frame_direction_maneuver_segment_with_maximum_allowed_angular_offset.solve(
|
|
654
|
+
state
|
|
655
|
+
)
|
|
656
|
+
)
|
|
657
|
+
assert solution_with_maximum_allowed_angular_offset is not None
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
class TestManeuverConstraints:
|
|
661
|
+
def test_constructors(
|
|
662
|
+
self,
|
|
663
|
+
maneuver_constraints: Segment.ManeuverConstraints,
|
|
664
|
+
):
|
|
665
|
+
# Default constructor
|
|
666
|
+
assert maneuver_constraints is not None
|
|
667
|
+
assert maneuver_constraints.minimum_duration is not None
|
|
668
|
+
assert maneuver_constraints.maximum_duration is not None
|
|
669
|
+
assert maneuver_constraints.minimum_separation is not None
|
|
670
|
+
assert maneuver_constraints.maximum_duration_strategy is not None
|
|
671
|
+
|
|
672
|
+
def test_is_defined(
|
|
673
|
+
self,
|
|
674
|
+
maneuver_constraints: Segment.ManeuverConstraints,
|
|
675
|
+
):
|
|
676
|
+
assert maneuver_constraints.is_defined()
|
|
677
|
+
|
|
678
|
+
def test_interval_has_valid_minimum_duration(
|
|
679
|
+
self,
|
|
680
|
+
maneuver_constraints: Segment.ManeuverConstraints,
|
|
681
|
+
interval: Interval,
|
|
682
|
+
):
|
|
683
|
+
assert (
|
|
684
|
+
maneuver_constraints.interval_has_valid_minimum_duration(interval) is not None
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
def test_interval_has_valid_maximum_duration(
|
|
688
|
+
self,
|
|
689
|
+
maneuver_constraints: Segment.ManeuverConstraints,
|
|
690
|
+
interval: Interval,
|
|
691
|
+
):
|
|
692
|
+
assert (
|
|
693
|
+
maneuver_constraints.interval_has_valid_maximum_duration(interval) is not None
|
|
694
|
+
)
|