open-space-toolkit-astrodynamics 2.4.1__py311-none-any.whl → 5.0.0__py311-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-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/METADATA +2 -2
- open_space_toolkit_astrodynamics-5.0.0.dist-info/RECORD +25 -0
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-311-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/__init__.py +6 -0
- ostk/astrodynamics/converters.py +1 -1
- ostk/astrodynamics/{libopen-space-toolkit-astrodynamics.so.2 → libopen-space-toolkit-astrodynamics.so.5} +0 -0
- ostk/astrodynamics/pytrajectory/pystate.py +36 -0
- ostk/astrodynamics/test/test_access.py +1 -1
- ostk/astrodynamics/test/test_converters.py +1 -1
- ostk/astrodynamics/test/test_event_condition.py +27 -2
- ostk/astrodynamics/test/test_import.py +2 -2
- ostk/astrodynamics/test/test_trajectory.py +1 -1
- ostk/astrodynamics/viewer.py +1 -1
- open_space_toolkit_astrodynamics-2.4.1.dist-info/RECORD +0 -83
- ostk/astrodynamics/test/access/__init__.py +0 -1
- ostk/astrodynamics/test/access/test_generator.py +0 -248
- ostk/astrodynamics/test/conjunction/messages/ccsds/__init__.py +0 -1
- ostk/astrodynamics/test/conjunction/messages/ccsds/conftest.py +0 -325
- ostk/astrodynamics/test/conjunction/messages/ccsds/data/cdm.json +0 -303
- ostk/astrodynamics/test/conjunction/messages/ccsds/test_cdm.py +0 -416
- ostk/astrodynamics/test/event_condition/test_angular_condition.py +0 -113
- ostk/astrodynamics/test/event_condition/test_boolean_condition.py +0 -55
- ostk/astrodynamics/test/event_condition/test_coe_condition.py +0 -91
- ostk/astrodynamics/test/event_condition/test_instant_condition.py +0 -48
- ostk/astrodynamics/test/event_condition/test_logical_condition.py +0 -120
- ostk/astrodynamics/test/event_condition/test_real_condition.py +0 -53
- ostk/astrodynamics/test/flight/__init__.py +0 -1
- ostk/astrodynamics/test/flight/profile/__init__.py +0 -1
- ostk/astrodynamics/test/flight/profile/test_state.py +0 -144
- ostk/astrodynamics/test/flight/system/__init__.py +0 -1
- ostk/astrodynamics/test/flight/system/dynamics/__init__.py +0 -1
- ostk/astrodynamics/test/flight/system/dynamics/test_atmospheric_drag.py +0 -128
- ostk/astrodynamics/test/flight/system/dynamics/test_central_body_gravity.py +0 -58
- ostk/astrodynamics/test/flight/system/dynamics/test_dynamics.py +0 -37
- ostk/astrodynamics/test/flight/system/dynamics/test_position_derivative.py +0 -51
- ostk/astrodynamics/test/flight/system/dynamics/test_third_body_gravity.py +0 -67
- ostk/astrodynamics/test/flight/system/dynamics/thruster/test_constant_thrust.py +0 -143
- ostk/astrodynamics/test/flight/system/test_propulsion_system.py +0 -46
- ostk/astrodynamics/test/flight/system/test_satellite_system.py +0 -77
- ostk/astrodynamics/test/flight/test_profile.py +0 -153
- ostk/astrodynamics/test/flight/test_system.py +0 -55
- ostk/astrodynamics/test/solvers/__init__.py +0 -1
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +0 -153
- ostk/astrodynamics/test/trajectory/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/messages/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/conftest.py +0 -18
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/data/opm_1.yaml +0 -44
- ostk/astrodynamics/test/trajectory/orbit/messages/spacex/test_opm.py +0 -108
- ostk/astrodynamics/test/trajectory/orbit/models/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +0 -112
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/__init__.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/models/sgp4/test_tle.py +0 -331
- ostk/astrodynamics/test/trajectory/orbit/models/test_kepler.py +0 -130
- ostk/astrodynamics/test/trajectory/orbit/models/test_propagated.py +0 -195
- ostk/astrodynamics/test/trajectory/orbit/models/test_sgp4.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/models/test_tabulated.py +0 -380
- ostk/astrodynamics/test/trajectory/orbit/test_model.py +0 -1
- ostk/astrodynamics/test/trajectory/orbit/test_pass.py +0 -55
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_position.py +0 -103
- ostk/astrodynamics/test/trajectory/state/coordinates_subset/test_cartesian_velocity.py +0 -113
- ostk/astrodynamics/test/trajectory/state/test_coordinates_broker.py +0 -71
- ostk/astrodynamics/test/trajectory/state/test_coordinates_subset.py +0 -43
- ostk/astrodynamics/test/trajectory/state/test_numerical_solver.py +0 -242
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_direction.py +0 -82
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +0 -64
- ostk/astrodynamics/test/trajectory/test_model.py +0 -1
- ostk/astrodynamics/test/trajectory/test_orbit.py +0 -92
- ostk/astrodynamics/test/trajectory/test_propagator.py +0 -387
- ostk/astrodynamics/test/trajectory/test_state.py +0 -134
- ostk/astrodynamics/test/trajectory/test_trajectory_segment.py +0 -136
- {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/WHEEL +0 -0
- {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/top_level.txt +0 -0
- {open_space_toolkit_astrodynamics-2.4.1.dist-info → open_space_toolkit_astrodynamics-5.0.0.dist-info}/zip-safe +0 -0
- /ostk/{__init__.py → astrodynamics/pytrajectory/__init__.py} +0 -0
@@ -1,64 +0,0 @@
|
|
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()
|
@@ -1 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
@@ -1,92 +0,0 @@
|
|
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()
|
@@ -1,387 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
import numpy as np
|
6
|
-
|
7
|
-
from ostk.mathematics.geometry.d3.objects import Cuboid
|
8
|
-
from ostk.mathematics.geometry.d3.objects import Composite
|
9
|
-
from ostk.mathematics.geometry.d3.objects import Point
|
10
|
-
|
11
|
-
from ostk.physics import Environment
|
12
|
-
from ostk.physics.units import Mass
|
13
|
-
from ostk.physics.time import Instant
|
14
|
-
from ostk.physics.time import DateTime
|
15
|
-
from ostk.physics.time import Scale
|
16
|
-
from ostk.physics.time import Duration
|
17
|
-
from ostk.physics.coordinate import Position
|
18
|
-
from ostk.physics.coordinate import Velocity
|
19
|
-
from ostk.physics.coordinate import Frame
|
20
|
-
from ostk.physics.environment.objects.celestial_bodies import Earth, Sun
|
21
|
-
from ostk.physics.environment.gravitational import Earth as EarthGravitationalModel
|
22
|
-
from ostk.physics.environment.magnetic import Earth as EarthMagneticModel
|
23
|
-
from ostk.physics.environment.atmospheric import Earth as EarthAtmosphericModel
|
24
|
-
|
25
|
-
from ostk.astrodynamics.trajectory import LocalOrbitalFrameFactory
|
26
|
-
from ostk.astrodynamics.trajectory import LocalOrbitalFrameDirection
|
27
|
-
|
28
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesSubset
|
29
|
-
from ostk.astrodynamics.trajectory.state.coordinates_subset import CartesianPosition
|
30
|
-
from ostk.astrodynamics.trajectory.state.coordinates_subset import CartesianVelocity
|
31
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesBroker
|
32
|
-
from ostk.astrodynamics.trajectory.state import NumericalSolver
|
33
|
-
|
34
|
-
from ostk.astrodynamics.flight.system import PropulsionSystem
|
35
|
-
from ostk.astrodynamics.flight.system import SatelliteSystem
|
36
|
-
from ostk.astrodynamics.flight.system import Dynamics
|
37
|
-
from ostk.astrodynamics.flight.system.dynamics import CentralBodyGravity
|
38
|
-
from ostk.astrodynamics.flight.system.dynamics.thruster import ConstantThrust
|
39
|
-
from ostk.astrodynamics.flight.system.dynamics import PositionDerivative
|
40
|
-
from ostk.astrodynamics.flight.system.dynamics import AtmosphericDrag
|
41
|
-
from ostk.astrodynamics.trajectory import State
|
42
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesSubset, CoordinatesBroker
|
43
|
-
from ostk.astrodynamics.trajectory.state.coordinates_subset import (
|
44
|
-
CartesianPosition,
|
45
|
-
CartesianVelocity,
|
46
|
-
)
|
47
|
-
from ostk.astrodynamics.trajectory import Propagator
|
48
|
-
|
49
|
-
from ostk.astrodynamics.event_condition import InstantCondition
|
50
|
-
|
51
|
-
|
52
|
-
@pytest.fixture
|
53
|
-
def propulsion_system() -> PropulsionSystem:
|
54
|
-
return PropulsionSystem(
|
55
|
-
1.0,
|
56
|
-
150.0,
|
57
|
-
)
|
58
|
-
|
59
|
-
|
60
|
-
@pytest.fixture
|
61
|
-
def satellite_system(propulsion_system: PropulsionSystem) -> SatelliteSystem:
|
62
|
-
mass = Mass(90.0, Mass.Unit.Kilogram)
|
63
|
-
satellite_geometry = Composite(
|
64
|
-
Cuboid(
|
65
|
-
Point(0.0, 0.0, 0.0),
|
66
|
-
[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]],
|
67
|
-
[1.0, 0.0, 0.0],
|
68
|
-
)
|
69
|
-
)
|
70
|
-
inertia_tensor = np.identity(3)
|
71
|
-
surface_area = 0.8
|
72
|
-
drag_coefficient = 0.0
|
73
|
-
|
74
|
-
return SatelliteSystem(
|
75
|
-
mass,
|
76
|
-
satellite_geometry,
|
77
|
-
inertia_tensor,
|
78
|
-
surface_area,
|
79
|
-
drag_coefficient,
|
80
|
-
propulsion_system,
|
81
|
-
)
|
82
|
-
|
83
|
-
|
84
|
-
@pytest.fixture
|
85
|
-
def earth() -> Earth:
|
86
|
-
return Earth.from_models(
|
87
|
-
EarthGravitationalModel(EarthGravitationalModel.Type.EGM96),
|
88
|
-
EarthMagneticModel(EarthMagneticModel.Type.Undefined),
|
89
|
-
EarthAtmosphericModel(EarthAtmosphericModel.Type.Exponential),
|
90
|
-
)
|
91
|
-
|
92
|
-
|
93
|
-
@pytest.fixture
|
94
|
-
def environment(earth) -> Environment:
|
95
|
-
sun = Sun.default()
|
96
|
-
|
97
|
-
return Environment(Instant.J2000(), [earth, sun])
|
98
|
-
|
99
|
-
|
100
|
-
@pytest.fixture
|
101
|
-
def coordinates_broker():
|
102
|
-
return CoordinatesBroker(
|
103
|
-
[
|
104
|
-
CartesianPosition.default(),
|
105
|
-
CartesianVelocity.default(),
|
106
|
-
CoordinatesSubset.mass(),
|
107
|
-
CoordinatesSubset.surface_area(),
|
108
|
-
CoordinatesSubset.drag_coefficient(),
|
109
|
-
]
|
110
|
-
)
|
111
|
-
|
112
|
-
|
113
|
-
@pytest.fixture
|
114
|
-
def state(
|
115
|
-
satellite_system: SatelliteSystem, coordinates_broker: CoordinatesBroker
|
116
|
-
) -> State:
|
117
|
-
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
118
|
-
|
119
|
-
propellant_mass: float = 10.0
|
120
|
-
|
121
|
-
coordinates: list = [
|
122
|
-
7500000.0,
|
123
|
-
0.0,
|
124
|
-
0.0,
|
125
|
-
0.0,
|
126
|
-
5335.865450622126,
|
127
|
-
5335.865450622126,
|
128
|
-
satellite_system.get_mass().in_kilograms() + propellant_mass,
|
129
|
-
]
|
130
|
-
|
131
|
-
return State(instant, coordinates, Frame.GCRF(), coordinates_broker)
|
132
|
-
|
133
|
-
|
134
|
-
@pytest.fixture
|
135
|
-
def state_low_altitude(
|
136
|
-
satellite_system: SatelliteSystem, coordinates_broker: CoordinatesBroker
|
137
|
-
) -> State:
|
138
|
-
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
139
|
-
|
140
|
-
propellant_mass: float = 10.0
|
141
|
-
area: float = satellite_system.get_cross_sectional_surface_area()
|
142
|
-
cd: float = satellite_system.get_drag_coefficient()
|
143
|
-
|
144
|
-
coordinates: list = [
|
145
|
-
7000000.0,
|
146
|
-
0.0,
|
147
|
-
0.0,
|
148
|
-
0.0,
|
149
|
-
5335.865450622126,
|
150
|
-
5335.865450622126,
|
151
|
-
satellite_system.get_mass().in_kilograms() + propellant_mass,
|
152
|
-
area,
|
153
|
-
cd,
|
154
|
-
]
|
155
|
-
|
156
|
-
return State(instant, coordinates, Frame.GCRF(), coordinates_broker)
|
157
|
-
|
158
|
-
|
159
|
-
@pytest.fixture
|
160
|
-
def central_body_gravity() -> CentralBodyGravity:
|
161
|
-
return CentralBodyGravity(Earth.WGS84(20, 0))
|
162
|
-
|
163
|
-
|
164
|
-
@pytest.fixture
|
165
|
-
def atmospheric_drag(environment, satellite_system) -> AtmosphericDrag:
|
166
|
-
return AtmosphericDrag(environment.access_celestial_object_with_name("Earth"))
|
167
|
-
|
168
|
-
|
169
|
-
@pytest.fixture
|
170
|
-
def position_derivative() -> PositionDerivative:
|
171
|
-
return PositionDerivative()
|
172
|
-
|
173
|
-
|
174
|
-
@pytest.fixture
|
175
|
-
def local_orbital_frame_direction() -> LocalOrbitalFrameDirection:
|
176
|
-
return LocalOrbitalFrameDirection(
|
177
|
-
[1.0, 0.0, 0.0],
|
178
|
-
LocalOrbitalFrameFactory.VNC(Frame.GCRF()),
|
179
|
-
)
|
180
|
-
|
181
|
-
|
182
|
-
@pytest.fixture
|
183
|
-
def constant_thrust(
|
184
|
-
satellite_system: SatelliteSystem,
|
185
|
-
local_orbital_frame_direction: LocalOrbitalFrameDirection,
|
186
|
-
) -> ConstantThrust:
|
187
|
-
return ConstantThrust(satellite_system, local_orbital_frame_direction)
|
188
|
-
|
189
|
-
|
190
|
-
@pytest.fixture
|
191
|
-
def dynamics(
|
192
|
-
position_derivative: PositionDerivative,
|
193
|
-
central_body_gravity: CentralBodyGravity,
|
194
|
-
) -> list:
|
195
|
-
return [position_derivative, central_body_gravity]
|
196
|
-
|
197
|
-
|
198
|
-
@pytest.fixture
|
199
|
-
def numerical_solver() -> NumericalSolver:
|
200
|
-
return NumericalSolver(
|
201
|
-
NumericalSolver.LogType.NoLog,
|
202
|
-
NumericalSolver.StepperType.RungeKuttaFehlberg78,
|
203
|
-
5.0,
|
204
|
-
1.0e-15,
|
205
|
-
1.0e-15,
|
206
|
-
)
|
207
|
-
|
208
|
-
|
209
|
-
@pytest.fixture
|
210
|
-
def conditional_numerical_solver() -> NumericalSolver:
|
211
|
-
return NumericalSolver(
|
212
|
-
NumericalSolver.LogType.NoLog,
|
213
|
-
NumericalSolver.StepperType.RungeKuttaDopri5,
|
214
|
-
5.0,
|
215
|
-
1.0e-15,
|
216
|
-
1.0e-15,
|
217
|
-
)
|
218
|
-
|
219
|
-
|
220
|
-
@pytest.fixture
|
221
|
-
def event_condition(state: State) -> InstantCondition:
|
222
|
-
return InstantCondition(
|
223
|
-
InstantCondition.Criterion.StrictlyPositive,
|
224
|
-
state.get_instant() + Duration.seconds(42.0),
|
225
|
-
)
|
226
|
-
|
227
|
-
|
228
|
-
@pytest.fixture
|
229
|
-
def propagator(numerical_solver: NumericalSolver, dynamics: list[Dynamics]) -> Propagator:
|
230
|
-
return Propagator(numerical_solver, dynamics)
|
231
|
-
|
232
|
-
|
233
|
-
class TestPropagator:
|
234
|
-
def test_constructors(self, propagator: Propagator):
|
235
|
-
assert propagator is not None
|
236
|
-
assert isinstance(propagator, Propagator)
|
237
|
-
assert propagator.is_defined()
|
238
|
-
|
239
|
-
def test_access_numerical_solver(
|
240
|
-
self, propagator: Propagator, numerical_solver: NumericalSolver
|
241
|
-
):
|
242
|
-
assert propagator.access_numerical_solver() == numerical_solver
|
243
|
-
|
244
|
-
def test_get_dynamics(self, propagator: Propagator, dynamics: list):
|
245
|
-
assert propagator.get_dynamics() == dynamics
|
246
|
-
|
247
|
-
def test_set_dynamics(self, propagator: Propagator, dynamics: list):
|
248
|
-
assert len(propagator.get_dynamics()) == 2
|
249
|
-
|
250
|
-
propagator.set_dynamics(dynamics + dynamics)
|
251
|
-
|
252
|
-
assert len(propagator.get_dynamics()) == 4
|
253
|
-
|
254
|
-
def test_add_dynamics(
|
255
|
-
self, propagator: Propagator, central_body_gravity: CentralBodyGravity
|
256
|
-
):
|
257
|
-
assert len(propagator.get_dynamics()) == 2
|
258
|
-
|
259
|
-
propagator.add_dynamics(central_body_gravity)
|
260
|
-
propagator.add_dynamics(central_body_gravity)
|
261
|
-
|
262
|
-
assert len(propagator.get_dynamics()) == 4
|
263
|
-
|
264
|
-
def test_clear_dynamics(self, propagator: Propagator):
|
265
|
-
assert len(propagator.get_dynamics()) >= 1
|
266
|
-
|
267
|
-
propagator.clear_dynamics()
|
268
|
-
|
269
|
-
assert len(propagator.get_dynamics()) == 0
|
270
|
-
|
271
|
-
def test_calculate_state_at(self, propagator: Propagator, state: State):
|
272
|
-
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC)
|
273
|
-
|
274
|
-
propagator_state = propagator.calculate_state_at(state, instant)
|
275
|
-
|
276
|
-
propagator_state_position_ref = np.array(
|
277
|
-
[6265892.25765909, 3024770.94961259, 3024359.72137468]
|
278
|
-
)
|
279
|
-
propagator_state_velocity_ref = np.array(
|
280
|
-
[-3974.49168221, 4468.16996776, 4466.19232746]
|
281
|
-
)
|
282
|
-
|
283
|
-
propagator_state_position = propagator_state.get_position().get_coordinates()
|
284
|
-
propagator_state_velocity = propagator_state.get_velocity().get_coordinates()
|
285
|
-
|
286
|
-
assert all(
|
287
|
-
[
|
288
|
-
round(propagator_state_position[i], 8)
|
289
|
-
== round(propagator_state_position_ref[i], 8)
|
290
|
-
for i in range(0, len(propagator_state_position_ref))
|
291
|
-
]
|
292
|
-
)
|
293
|
-
assert all(
|
294
|
-
[
|
295
|
-
round(propagator_state_velocity[i], 8)
|
296
|
-
== round(propagator_state_velocity_ref[i], 8)
|
297
|
-
for i in range(0, len(propagator_state_velocity_ref))
|
298
|
-
]
|
299
|
-
)
|
300
|
-
assert propagator_state.get_instant() == instant
|
301
|
-
|
302
|
-
def test_calculate_state_at(
|
303
|
-
self,
|
304
|
-
conditional_numerical_solver: NumericalSolver,
|
305
|
-
dynamics: list[Dynamics],
|
306
|
-
state: State,
|
307
|
-
event_condition: InstantCondition,
|
308
|
-
):
|
309
|
-
propagator: Propagator = Propagator(conditional_numerical_solver, dynamics)
|
310
|
-
|
311
|
-
instant: Instant = Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC)
|
312
|
-
|
313
|
-
propagator_state = propagator.calculate_state_at(state, instant, event_condition)
|
314
|
-
|
315
|
-
assert pytest.approx(42.0, abs=1e-3) == float(
|
316
|
-
(propagator_state.get_instant() - state.get_instant()).in_seconds()
|
317
|
-
)
|
318
|
-
|
319
|
-
def test_calculate_states_at(self, propagator: Propagator, state: State):
|
320
|
-
instant_array = [
|
321
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC),
|
322
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 20, 0), Scale.UTC),
|
323
|
-
]
|
324
|
-
|
325
|
-
_ = propagator.calculate_states_at(state, instant_array)
|
326
|
-
|
327
|
-
with pytest.raises(RuntimeError):
|
328
|
-
instant_array.reverse()
|
329
|
-
propagator.calculate_states_at(state, instant_array)
|
330
|
-
|
331
|
-
def test_calculate_states_at_with_drag(
|
332
|
-
self,
|
333
|
-
numerical_solver: NumericalSolver,
|
334
|
-
dynamics: list[Dynamics],
|
335
|
-
atmospheric_drag: AtmosphericDrag,
|
336
|
-
state_low_altitude: State,
|
337
|
-
):
|
338
|
-
propagator: Propagator = Propagator(
|
339
|
-
numerical_solver, dynamics + [atmospheric_drag]
|
340
|
-
)
|
341
|
-
|
342
|
-
instant_array = [
|
343
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC),
|
344
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 20, 0), Scale.UTC),
|
345
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 30, 0), Scale.UTC),
|
346
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 40, 0), Scale.UTC),
|
347
|
-
]
|
348
|
-
|
349
|
-
_ = propagator.calculate_states_at(state_low_altitude, instant_array)
|
350
|
-
|
351
|
-
def test_calculate_states_at_with_thrust(
|
352
|
-
self,
|
353
|
-
numerical_solver: NumericalSolver,
|
354
|
-
dynamics: list[Dynamics],
|
355
|
-
constant_thrust: ConstantThrust,
|
356
|
-
state: State,
|
357
|
-
):
|
358
|
-
propagator: Propagator = Propagator(
|
359
|
-
numerical_solver, dynamics + [constant_thrust]
|
360
|
-
)
|
361
|
-
|
362
|
-
instant_array = [
|
363
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 10, 0), Scale.UTC),
|
364
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 20, 0), Scale.UTC),
|
365
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 30, 0), Scale.UTC),
|
366
|
-
Instant.date_time(DateTime(2018, 1, 1, 0, 40, 0), Scale.UTC),
|
367
|
-
]
|
368
|
-
|
369
|
-
_ = propagator.calculate_states_at(state, instant_array)
|
370
|
-
|
371
|
-
def test_from_environment(
|
372
|
-
self,
|
373
|
-
numerical_solver: NumericalSolver,
|
374
|
-
environment: Environment,
|
375
|
-
satellite_system: SatelliteSystem,
|
376
|
-
):
|
377
|
-
assert Propagator.from_environment(numerical_solver, environment) is not None
|
378
|
-
|
379
|
-
assert (
|
380
|
-
Propagator.from_environment(numerical_solver, environment, satellite_system)
|
381
|
-
is not None
|
382
|
-
)
|
383
|
-
|
384
|
-
def test_default(self, environment: Environment, satellite_system: SatelliteSystem):
|
385
|
-
assert Propagator.default()
|
386
|
-
assert Propagator.default(environment) is not None
|
387
|
-
assert Propagator.default(environment, satellite_system) is not None
|
@@ -1,134 +0,0 @@
|
|
1
|
-
# Apache License 2.0
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
|
5
|
-
import numpy as np
|
6
|
-
|
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.coordinate import Position
|
11
|
-
from ostk.physics.coordinate import Velocity
|
12
|
-
from ostk.physics.coordinate import Frame
|
13
|
-
|
14
|
-
from ostk.astrodynamics.trajectory import State
|
15
|
-
from ostk.astrodynamics.trajectory.state import CoordinatesBroker
|
16
|
-
from ostk.astrodynamics.trajectory.state.coordinates_subset import (
|
17
|
-
CartesianPosition,
|
18
|
-
CartesianVelocity,
|
19
|
-
)
|
20
|
-
|
21
|
-
|
22
|
-
@pytest.fixture()
|
23
|
-
def instant() -> Instant:
|
24
|
-
return Instant.date_time(DateTime(2018, 1, 1, 0, 0, 0), Scale.UTC)
|
25
|
-
|
26
|
-
|
27
|
-
@pytest.fixture
|
28
|
-
def frame() -> Frame:
|
29
|
-
return Frame.GCRF()
|
30
|
-
|
31
|
-
|
32
|
-
@pytest.fixture()
|
33
|
-
def position(frame: Frame) -> Position:
|
34
|
-
return Position.meters([6371000.0, 0.0, 0.0], frame)
|
35
|
-
|
36
|
-
|
37
|
-
@pytest.fixture()
|
38
|
-
def velocity(frame: Frame) -> Velocity:
|
39
|
-
return Velocity.meters_per_second([7600.0, 0.0, 0.0], frame)
|
40
|
-
|
41
|
-
|
42
|
-
@pytest.fixture
|
43
|
-
def state(
|
44
|
-
instant: Instant, position: Position, velocity: Velocity, frame: Frame
|
45
|
-
) -> State:
|
46
|
-
return State(instant, position, velocity)
|
47
|
-
|
48
|
-
|
49
|
-
@pytest.fixture
|
50
|
-
def coordinates_broker() -> CoordinatesBroker:
|
51
|
-
return CoordinatesBroker([CartesianPosition.default(), CartesianVelocity.default()])
|
52
|
-
|
53
|
-
|
54
|
-
class TestState:
|
55
|
-
def test_constructor(
|
56
|
-
self,
|
57
|
-
instant: Instant,
|
58
|
-
position: Position,
|
59
|
-
velocity: Velocity,
|
60
|
-
):
|
61
|
-
state = State(instant, position, velocity)
|
62
|
-
assert state is not None
|
63
|
-
assert isinstance(state, State)
|
64
|
-
assert state.is_defined()
|
65
|
-
|
66
|
-
def test_explicit_constructor(
|
67
|
-
self,
|
68
|
-
instant: Instant,
|
69
|
-
position: Position,
|
70
|
-
velocity: Velocity,
|
71
|
-
frame: Frame,
|
72
|
-
coordinates_broker: CoordinatesBroker,
|
73
|
-
):
|
74
|
-
state = State(instant, position, velocity)
|
75
|
-
assert state is not None
|
76
|
-
assert isinstance(state, State)
|
77
|
-
assert state.is_defined()
|
78
|
-
|
79
|
-
state = State(
|
80
|
-
instant,
|
81
|
-
np.append(position.get_coordinates(), velocity.get_coordinates()),
|
82
|
-
frame,
|
83
|
-
coordinates_broker,
|
84
|
-
)
|
85
|
-
|
86
|
-
assert state is not None
|
87
|
-
assert isinstance(state, State)
|
88
|
-
assert state.is_defined()
|
89
|
-
|
90
|
-
def test_comparators(self, state: State):
|
91
|
-
assert (state == state) is True
|
92
|
-
assert (state != state) is False
|
93
|
-
|
94
|
-
def test_operators(self, state: State):
|
95
|
-
assert isinstance(state + state, State)
|
96
|
-
assert isinstance(state - state, State)
|
97
|
-
|
98
|
-
def test_getters(
|
99
|
-
self,
|
100
|
-
state: State,
|
101
|
-
instant: Instant,
|
102
|
-
position: Position,
|
103
|
-
velocity: Velocity,
|
104
|
-
frame: Frame,
|
105
|
-
coordinates_broker: CoordinatesBroker,
|
106
|
-
):
|
107
|
-
assert state.get_instant() == instant
|
108
|
-
assert state.get_position() == position
|
109
|
-
assert state.get_velocity() == velocity
|
110
|
-
assert state.get_frame() == frame
|
111
|
-
assert (
|
112
|
-
state.get_coordinates()
|
113
|
-
== np.append(position.get_coordinates(), velocity.get_coordinates())
|
114
|
-
).all()
|
115
|
-
assert state.get_coordinates_subsets() == coordinates_broker.get_subsets()
|
116
|
-
|
117
|
-
def test_in_frame(
|
118
|
-
self,
|
119
|
-
state: State,
|
120
|
-
frame: Frame,
|
121
|
-
):
|
122
|
-
assert state.in_frame(frame) == state
|
123
|
-
assert state.in_frame(Frame.ITRF()) != state
|
124
|
-
|
125
|
-
def test_extract_coordinates(
|
126
|
-
self,
|
127
|
-
state: State,
|
128
|
-
):
|
129
|
-
position_coordinates = state.extract_coordinates(CartesianPosition.default())
|
130
|
-
velocity_coordinates = state.extract_coordinates(CartesianVelocity.default())
|
131
|
-
len(position_coordinates) == 3
|
132
|
-
len(velocity_coordinates) == 3
|
133
|
-
assert (position_coordinates == state.get_position().get_coordinates()).all()
|
134
|
-
assert (velocity_coordinates == state.get_velocity().get_coordinates()).all()
|