A user-friendly, extensible Python-based simulator for analyzing routing algorithms in LEO satellite constellations.
Project description
LEOPath: A LEO Satellite Routing Simulation Framework
A simple, user-friendly and extensible simulation framework for analyzing and comparing routing algorithms in Low Earth Orbit (LEO) satellite constellations.
This tool enables researchers and engineers to study network dynamics, routing performance, and connectivity patterns in satellite networks such as Starlink, Kuiper, and other LEO constellations.
Table of Contents
- LEOPath: A LEO Satellite Routing Simulation Framework
Overview & Features
This project provides a simple yet complete toolkit for quickly simulating and analyzing LEO satellite network routing running in commodity hardware.
- ๐ณ Very easy to run: Can run everywhere using docker containers.
- ๐ฐ๏ธ Realistic Satellite Modeling: Model realistic LEO satellite constellations with configurable parameters (altitude, inclination, number of satellites, etc.) using Two-Line Element (TLE) sets and SGP4 propagation model.
- ๐ Real or Custom Constellations: Simulate well-known constellations like Starlink using data directly from Celestrak or create custom configurations with the included synthetic TLE generation.
- ๐ Dynamic Network State: Simulate time-varying network states with dynamic Inter-Satellite Links (ISLs) and Ground Station Links (GSLs).
- ๐ Pluggable Routing Algorithms: Compare different routing strategies and GSL attachment policies through a pluggable architecture.
- ๐บ๏ธ Ground Station Integration: Support for multiple ground stations with realistic visibility constraints.
- ๐จ 3D Visualization: Generate interactive 3D visualizations of satellite orbits, connectivity patterns, and ground station coverage using Cesium.
The framework currently supports the following routing algorithms:
- Shortest Path Link-State Routing: Traditional Dijkstra-based routing over satellite networks
- Topological Routing: Novel routing algorithm based on the 6G-RUPA architecture for improved scalability and reduced control overhead
Why LEOPath?
LEOPath is essentially a fork of an existing simulator called Hypatia. While Hypatia provides valuable foundations for satellite network simulation, it has limitations when executing it or extending it, such as tightly coupled routing logic that makes it difficult to implement and compare new protocols or inflexible data output formats that complicate analysis.
LEOPath uses Hypatia core logic but makes it extremely easy to use, maintain and extend.
What LEOPath Does
- Satellite Movement Simulation: Modeling of satellite orbital mechanics using SGP4 propagation model.
- Dynamic Link Management: Automatic management of Inter-Satellite Links (ISLs) and Ground-to-Satellite Links (GSLs) based on visibility and distance constraints
- Synthetic TLE Generation: Creates Two-Line Element sets from orbital parameters, enabling simulation of arbitrary constellation configurations
- Pluggable GSL Attachment Strategies: Flexible framework for implementing different ground station attachment policies (currently includes nearest satellite strategy with extensible architecture)
- Modular Routing Protocol Framework: Clean separation of routing logic allowing easy implementation and comparison of different routing protocols, including:
- Traditional link-state shortest path routing as a baseline
- Novel topological routing scheme with hierarchical addressing
- Easy extension for custom routing algorithms
What LEOPath Does Not Do
LEOPath focuses on network topology and routing state generation, not full protocol stack simulation. It does not simulate:
- Complete network protocol stacks (TCP/IP, application layers)
- Packet-level processing and queueing
- Physical layer details (modulation, coding, interference)
For packet-level simulations, LEOPath's forwarding state output can be integrated with network simulators like NS-3 (as demonstrated in Hypatia), enabling end-to-end performance evaluation when needed.
Prerequisites
For Docker Deployment (Recommended)
The run-simulations.sh script handles all Docker operations automatically. You only need:
- Docker Engine 20.10+
- Docker Compose 1.29+
- Bash shell (available by default on Linux/macOS)
For Local Development
- Python 3.8 or higher
- pip (Python package installer)
- virtualenv (recommended)
Installation
The project can be installed directly using the pip package manager.
From PyPI (Recommended for usage)
You can install LEOPath directly from PyPI:
pip install leopath
Using Docker (Recommended for simulations)
The easiest way to run simulations is using the run-simulations.sh convenience script, which handles Docker operations automatically:
-
Clone the repository:
git clone https://github.com/Fundacio-i2CAT/leo-routing-simu.git cd leo-routing-simu
-
Run simulations with the convenience script:
# Run simulation with a specific configuration ./run-simulations.sh run -c leopath/config/ether_simple.yaml # Generate visualization for the simulation ./run-simulations.sh visualise -c leopath/config/ether_simple.yaml # Clean up all generated files and containers ./run-simulations.sh clean
The script provides:
- Automatic Docker image building on first run
- Output directory creation and management
- Configuration file validation
- Color-coded status messages
- Built-in HTTP server for visualizations (port 8080)
-
Alternatively, use Docker Compose directly:
# Build the Docker image docker-compose build # Run a simulation docker compose run --rm leo-routing-simu leopath/config/ether_simple.yaml # Generate visualization docker compose run --rm --entrypoint "python -m leopath.satellite_visualisation.cesium_builder.main" leo-routing-viz leopath/config/ether_simple.yaml # Start web server to view results docker compose up -d viz-server
Output Organization:
All outputs are automatically organized in the output/ directory:
output/logs/- Simulation logsoutput/simulation/- Simulation results and forwarding statesoutput/tles/- Generated TLE files for satellite orbitsoutput/visualizations/- Interactive HTML visualizations
View visualizations at: http://localhost:8080
Local Installation
For development or customization, you can install the framework locally:
-
Clone the repository:
git clone https://github.com/yourusername/leo-routing-simu.git cd leo-routing-simu
-
Create and activate a virtual environment:
# Using virtualenv virtualenv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Or using venv python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install the project:
pip install -e .
This installs the project in editable mode using pip, including all dependencies.
-
Verify installation:
python -m pytest tests/
Quick Start
Get started with a simple simulation in minutes using the convenience script:
# 1. Run a basic simulation with a simplified constellation (uses Docker)
./run-simulations.sh run -c leopath/config/ether_simple.yaml
# 2. Check the generated output
ls -l output/logs/
ls -l output/simulation/
# 3. Generate and view visualization (starts HTTP server on port 8080)
./run-simulations.sh visualise -c leopath/config/ether_simple.yaml
# 4. Open your browser to http://localhost:8080
# The visualization will be available at the web interface
# 5. Clean up when done
./run-simulations.sh clean
Usage
Running Simulations
The main simulation entry point accepts a configuration file that defines all simulation parameters.
Using the installed package (Recommended):
leopath --config <path-to-config.yaml>
Running as a module:
python -m leopath.main --config <path-to-config.yaml>
Available example configurations:
leopath/config/ether_simple.yaml- Simplified constellation (18 orbits, 18 satellites per orbit) for quick testingleopath/config/starlink.yaml- Full-scale Starlink-like constellation (22 orbits, 72 satellites per orbit)
Simulation outputs are stored in timestamped directories:
output/
โโโ logs/ # Simulation execution logs
โ โโโ simulation.log
โโโ simulation/ # Forwarding state data per time step
โโโ tles/ # Generated TLE files for satellite orbits
โโโ visualizations/ # HTML visualization files
Configuration
The simulation is configured through YAML files that define constellation parameters, simulation settings, ground stations, and network characteristics.
Example configuration (leopath/config/ether_simple.yaml):
constellation:
name: "Starlink-550"
num_orbits: 18
num_sats_per_orbit: 18
phase_diff: true
inclination_degree: 60
eccentricity: 0.0000001
arg_of_perigee_degree: 0.0
mean_motion_rev_per_day: 15.19
tle_output_filename: "ether_simple_tles.txt"
simulation:
dynamic_state_algorithm: shortest_path_link_state # or topological_routing
end_time_hours: 24
time_step_minutes: 10
offset_ns: 0
satellite:
altitude_m: 600000
cone_angle_degrees: 29.0
ground_stations:
- name: "London"
latitude: 51.5074
longitude: -0.1278
elevation_m: 30.0
- name: "Perth"
latitude: -31.9505
longitude: 115.8605
elevation_m: 30.0
network:
gsl_interfaces:
number_of_interfaces: 1
aggregate_max_bandwidth: 1.0
logging:
is_debug: false
file_name: "simulation.log"
Key configuration parameters:
| Parameter | Description | Example Values |
|---|---|---|
num_orbits |
Number of orbital planes | 18, 22, 72 |
num_sats_per_orbit |
Satellites per orbital plane | 15, 18, 72 |
inclination_degree |
Orbital inclination angle | 40, 53, 60 |
altitude_m |
Satellite altitude in meters | 550000-1200000 |
dynamic_state_algorithm |
Routing algorithm to use | shortest_path_link_state, topological_routing |
end_time_hours |
Simulation duration in hours | 1, 24, 96 |
time_step_minutes |
Time between topology snapshots | 5, 10, 30 |
cone_angle_degrees |
Satellite antenna beam width | 27-40 |
Visualization
After running a simulation, generate interactive 3D visualizations using Cesium.
Note: To use the visualization, you need a Cesium Ion Access Token.
- Sign up for a free account at Cesium Ion.
- Get your default access token.
- Open
leopath/satellite_visualisation/static_html/top.htmland replaceYOUR_CESIUM_ION_TOKENwith your actual token.
# Generate visualization from simulation config
python -m leopath.satellite_visualisation.cesium_builder.main leopath/config/ether_simple.yaml
# Start a local web server
python -m http.server 8000
# Open in browser
# Navigate to: http://localhost:8000/leopath/satellite_visualisation/visualisation_output/
The visualization includes satellite orbits and positions over time
Project Structure
leo-routing-simu/
โโโ leopath/
โ โโโ main.py # Main simulation entry point
โ โโโ logger.py # Logging configuration
โ โโโ config/ # Configuration files
โ โโโ network_state/ # Network state generation
โ โ โโโ generate_network_state.py # Dynamic state computation
โ โ โโโ gsl_attachment/ # Ground station link strategies
โ โ โโโ routing_algorithms/ # Routing algorithm implementations
โ โ โโโ shortest_path_link_state_routing/
โ โ โโโ topological_routing/
โ โโโ satellite_visualisation/ # Visualization tools
โ โ โโโ visualise_constellation.py
โ โ โโโ cesium_builder/ # Cesium-based 3D visualization
โ โโโ tles/ # TLE generation and parsing
โ โ โโโ generate_tles_from_scratch.py
โ โ โโโ read_tles.py
โ โโโ topology/ # Topology modeling
โ โโโ constellation.py # Constellation data structures
โ โโโ topology.py # Network topology management
โ โโโ isl.py # Inter-Satellite Link modeling
โ โโโ ground_station.py # Ground station management
โ โโโ satellite/ # Satellite models
โโโ tests/ # Comprehensive test suite
โโโ output/ # Simulation outputs (generated)
โ โโโ logs/
โ โโโ simulation/
โ โโโ tles/
โ โโโ visualizations/
Routing Algorithms
The framework supports multiple routing algorithms through a pluggable architecture:
1. Shortest Path Link-State Routing
Description: Traditional Dijkstra-based shortest path routing where each node maintains a complete view of the network topology and computes shortest paths to all destinations. This is basically what Hypatia implements.
Configuration: dynamic_state_algorithm: shortest_path_link_state
2. Topological Routing
Description: Novel routing algorithm based on the 6G-RUPA architecture that exploits the regular topology of LEO constellations. Uses hierarchical topological addressing to reduce routing table sizes and control overhead.
Configuration: dynamic_state_algorithm: topological_routing
Adding Custom Routing Algorithms
To implement a new routing algorithm:
- Create a new class inheriting from
RoutingAlgorithminleopath/network_state/routing_algorithms/. - Implement the required abstract method
compute_state. - Register the algorithm in
leopath/network_state/routing_algorithms/routing_algorithm_factory.py. - Update configuration files to use your new algorithm.
Step 1: Create the Algorithm Class
Create a new file (e.g., my_custom_routing.py) in leopath/network_state/routing_algorithms/ or a subdirectory.
from leopath.network_state.routing_algorithms.routing_algorithm import RoutingAlgorithm
from leopath.topology.topology import ConstellationData, GroundStation, LEOTopology
class MyCustomRoutingAlgorithm(RoutingAlgorithm):
def compute_state(
self,
time_since_epoch_ns: int,
constellation_data: ConstellationData,
ground_stations: list[GroundStation],
topology_with_isls: LEOTopology,
ground_station_satellites_in_range: list,
list_gsl_interfaces_info: list,
) -> dict:
"""
Implement your routing logic here.
:return: Dictionary containing 'fstate' and 'bandwidth' state objects.
"""
# ... implementation ...
return {
"fstate": my_fstate,
"bandwidth": my_bandwidth
}
Step 2: Register the Algorithm
Edit leopath/network_state/routing_algorithms/routing_algorithm_factory.py:
from .my_custom_routing import MyCustomRoutingAlgorithm
def get_routing_algorithm(name: str):
if name == "shortest_path_link_state":
return ShortestPathLinkStateRoutingAlgorithm()
elif name == "topological_routing":
return TopologicalRoutingAlgorithm()
elif name == "my_custom_algorithm": # Add this
return MyCustomRoutingAlgorithm()
else:
raise ValueError(f"Unknown routing algorithm: {name}")
Step 3: Update Configuration
In your configuration file (e.g., config/ether_simple.yaml), set:
dynamic_state_algorithm: "my_custom_algorithm"
Output Format
The simulation generates forwarding state files that describe the routing decisions at each time step.
Forwarding State Format:
Each line in the forwarding state file represents a routing entry:
[src-node],[dst-node],[next-hop],[src-interface-id],[next-hop-interface-id]
Fields:
src-node: Source node ID (satellite or ground station)dst-node: Destination node IDnext-hop: Next hop node ID on the path to destinationsrc-interface-id: Interface ID on the source node to send the packetnext-hop-interface-id: Interface ID on the next-hop node that will receive the packet
Example:
301,992,340,3,5
This translates to: A packet at node 301 destined for node 992 will be forwarded to node 340. Node 301 will enqueue the packet on its interface 3, which connects to interface 5 of node 340.
Output Files:
output/simulation/fstate_<timestamp>.txt- Forwarding state at specific simulation timeoutput/logs/simulation.log- Detailed simulation execution logoutput/tles/<constellation>_tles.txt- Generated TLE data for satellites
Testing
The project includes a comprehensive test suite covering all major components:
# Run all tests
pytest tests/
# Run specific test categories
pytest tests/topology/ # Topology generation tests
pytest tests/network_state/ # Network state computation tests
pytest tests/forwarding_state/ # Routing algorithm tests
pytest tests/integration/ # End-to-end integration tests
# Run with coverage report
pytest --cov=src --cov-report=html tests/
# Run specific test file
pytest tests/topology/test_gsl_attachment_integration.py -v
Test Categories:
- Topology Tests: Validate constellation generation, ISL establishment, GSL attachment
- Network State Tests: Verify dynamic state computation and routing algorithm correctness
- Forwarding State Tests: Test routing decisions and path computation
- Integration Tests: End-to-end simulation workflows
Contributing
Reporting Issues
- Use the GitHub issue tracker to report bugs or suggest features
- Provide detailed information including:
- Steps to reproduce the issue
- Expected vs actual behavior
- Configuration files used
- Relevant log outputs
Pull Requests
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with clear commit messages
- Add tests for new functionality
- Ensure all tests pass (
pytest tests/) - Format code with Black (
black leopath/ tests/) - Run linters (
flake8 leopath/ tests/) - Submit a pull request
Note: By contributing to this project, you agree that your contributions will be licensed under the AGPL-3.0 license.
Code Style
- Follow PEP 8 style guidelines
- Use Black for code formatting (line length: 100)
- Use isort for import sorting
- Write docstrings for public functions and classes
- Add type hints where appropriate
Adding New Features
New Routing Algorithms:
- Create implementation in
leopath/network_state/routing_algorithms/ - Inherit from
RoutingAlgorithmbase class - Register in
routing_algorithm_factory.py - Add tests in
tests/forwarding_state/ - Update documentation
New GSL Attachment Strategies:
- Implement strategy in
leopath/network_state/gsl_attachment/ - Register with decorator pattern
- Add integration tests
- Document in configuration guide
Copyright
This code has been developed by Fundaciรณ Privada Internet i Innovaciรณ Digital a Catalunya (i2CAT).
Portions of this software are based on Hypatia, Copyright (c) 2020 ETH Zurich, licensed under the MIT License.
i2CAT is a non-profit research and innovation centre that promotes mission-driven knowledge to solve business challenges, co-create solutions with a transformative impact, empower citizens through open and participative digital social innovation with territorial capillarity, and promote pioneering and strategic initiatives. i2CAT aims to transfer research project results to private companies in order to create social and economic impact via the out-licensing of intellectual property and the creation of spin-offs.
Find more information about i2CAT projects and IP rights at https://i2cat.net/tech-transfer/
License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
This code is licensed under the terms of the AGPL. Information about the license can be located at https://www.gnu.org/licenses/agpl-3.0.html.
This strong copyleft license was chosen to ensure that improvements to satellite network routing research remain accessible to the broader research community.
If you find that this license doesn't fit with your requirements regarding the use, distribution or redistribution of our code for your specific work, please, donโt hesitate to contact the intellectual property managers in i2CAT at the following address: techtransfer@i2cat.net Also, in the following page youโll find more information about the current commercialization status or other licensees: Under Development.
Acknowledgements
This simulator is heavily inspired by Hypatia. Hypatia provides a comprehensive framework for simulating LEO satellite networks, and many of the core concepts, architectural patterns, and simulation methodologies used in this project are adapted from Hypatia's design.
Key Technologies:
- SGP4 - Satellite orbit propagation
- Ephem - Astronomical ephemeris calculations
- Cesium - 3D geospatial visualization
- NetworkX - Graph algorithms and network analysis
- Hypatia - LEO satellite network simulator (inspiration and foundation)
Attributions
Attributions of Third Party Components of this work:
- SGP4 Version 2.24 - https://pypi.org/project/sgp4/ - MIT license
- ephem Version 4.2 - https://rhodesmill.org/pyephem/ - MIT license
- NetworkX Version 3.4.2 - https://networkx.org/ - BSD 3-Clause License
- NumPy Version 2.2.4 - https://numpy.org/ - BSD 3-Clause License
- Matplotlib Version 3.10.1 - https://matplotlib.org/ - PSF License (Python Software Foundation)
- PyYAML Version 6.0.2 - https://pyyaml.org/ - MIT license
- python-dateutil Version 2.9.0 - https://pypi.org/project/python-dateutil/ - dual license - either Apache 2.0 License or the BSD 3-Clause License
- geopy Version 2.4.1 - https://pypi.org/project/geopy/ - MIT license
- pandas Version 2.2.3 - https://pandas.pydata.org/ - BSD 3-Clause License
- czml3 Version 2.3.4 - https://pypi.org/project/czml3/ - MIT license
- astropy Version 7.0.1 - https://www.astropy.org/ - BSD 3-Clause License
- pytest Version 8.3.5 - https://pytest.org/ - MIT license
- pydantic Version 2.11.4 - https://docs.pydantic.dev/ - MIT license
- Cartopy Version 0.24.1 - https://scitools.org.uk/cartopy/docs/latest/ - LGPL-3.0 license
Contact
Project Maintainer:
- Sergio Gimรฉnez @sergio-gimenez (sergio.gimenez@i2cat.net)
Contributors:
- Sergio Gimรฉnez @sergio-gimenez (sergio.gimenez@i2cat.net)
- Eduard Grasa @edugrasa (eduard.grasa@i2cat.net)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file leopath-0.1.1.tar.gz.
File metadata
- Download URL: leopath-0.1.1.tar.gz
- Upload date:
- Size: 107.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a93367ed06c85076d8cabab4986bc563fd78edaa1dd35172b737432f55e100d
|
|
| MD5 |
fc141afbe57c0e5e9dbe61b310eae081
|
|
| BLAKE2b-256 |
ea1c5f2357e4ff0ede3bfa0cb29e087989503193aa251d09c513b8242a26e9d5
|
File details
Details for the file leopath-0.1.1-py3-none-any.whl.
File metadata
- Download URL: leopath-0.1.1-py3-none-any.whl
- Upload date:
- Size: 106.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc67cb3380f3ebf1d36e67a5647c1411e61d294b857ebda6343c1a3749abc1b1
|
|
| MD5 |
8677cf210eb2bf459753a782edd8a575
|
|
| BLAKE2b-256 |
52da793a18d0871aadb0402bca77b520deb857ebea6e46460ea58c10b25091bb
|