-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adrian G L
committed
Apr 15, 2026
1 parent
83a317e
commit 4c0319e
Showing
5 changed files
with
97 additions
and
254 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| """Hypso 1 test: 1-month deorbit simulation without oxide calculations.""" | ||
|
|
||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| sys.path.insert(0, str(Path(__file__).parent.parent)) | ||
|
|
||
| import numpy as np | ||
|
|
||
| from src import Satellite, Simulation, SimulationConfig, State | ||
| from src.constants import EARTH_GRAVITATIONAL_PARAMETER, EARTH_RADIUS | ||
| from src.environment.atmosphere import Nrlmsise00Density | ||
| from src.events import DeorbitEvent, TimeLimitEvent | ||
| from src.forces import AtmosphericDrag, GravityGradientTorque, NewtonianGravity | ||
| from src.visualization import visualize_orbit | ||
|
|
||
|
|
||
| def get_default_stl_path() -> Path | None: | ||
| repo_root = Path(__file__).parent.parent | ||
| stl_file = repo_root / "sattelite.stl" | ||
| return stl_file if stl_file.exists() else None | ||
|
|
||
|
|
||
| def main(): | ||
| stl_path = get_default_stl_path() | ||
| sat = Satellite( | ||
| mass=7.6, | ||
| drag_area=0.06, | ||
| drag_coefficient=2.2, | ||
| min_drag_area=0.06, | ||
| max_drag_area=0.06, | ||
| stl_path=stl_path, | ||
| name="hypso 1", | ||
| ) | ||
|
|
||
| altitude = 436_880 | ||
| expected_altitude = 395_977 | ||
| six_months = 182.625 * 86400 | ||
|
|
||
| r = EARTH_RADIUS + altitude | ||
| v = np.sqrt(EARTH_GRAVITATIONAL_PARAMETER / r) | ||
|
|
||
| state = State( | ||
| position=np.array([r, 0, 0]), | ||
| velocity=np.array([0.0, v, 0.1]), | ||
| time=0.0, | ||
| rotation_euler=np.array([0.5, 0.8, 0.3]), | ||
| angular_velocity_vec=np.array([1e-4, 1e-4, 1e-4]), | ||
| temperature_atmosphere=300.0, | ||
| temperature_sattelite=280.0, | ||
| oxide_thickness=0.0, | ||
| ) | ||
|
|
||
| atmosphere = Nrlmsise00Density() | ||
|
|
||
| forces = [ | ||
| NewtonianGravity(), | ||
| AtmosphericDrag(atmosphere), | ||
| GravityGradientTorque(stiffness=1e-10, damping=0.01), | ||
| ] | ||
|
|
||
| events = [ | ||
| DeorbitEvent(), | ||
| TimeLimitEvent(max_time=six_months), | ||
| ] | ||
|
|
||
| print(f"Hypso 1 - {altitude / 1000:.2f} km initial altitude") | ||
| print(f"Simulating for 6 months ({six_months / 86400:.1f} days)...") | ||
| sim = Simulation( | ||
| state, | ||
| sat, | ||
| forces, | ||
| events, | ||
| SimulationConfig(dt=3.0, save_interval=500), | ||
| ) | ||
| sim.run() | ||
|
|
||
| final_alt_km = sim.final_state.altitude() / 1000 | ||
| expected_km = expected_altitude / 1000 | ||
| diff_km = final_alt_km - expected_km | ||
|
|
||
| print(f"\nFinal altitude: {final_alt_km:.3f} km") | ||
| print(f"Expected altitude: {expected_km:.3f} km") | ||
| print(f"Diff: {diff_km:+.3f} km") | ||
| print(f"Sim time: {sim.final_state.time / 86400:.2f} days") | ||
| print(f"Steps: {sim.step_count}") | ||
|
|
||
| if len(sim.history) > 1: | ||
| print("\nOpening 3D visualization...") | ||
| visualize_orbit(sim.history, sat, title="Hypso 1 Deorbit") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters