Getting Started - Connor-bett-swin/i54SatelliteSwarms GitHub Wiki

Contents

  1. Environment Setup
  2. FLOMPS

Environment Setup

Python venv

Run the following in your desired folder:

python -m venv .venv
pip install -r requirements.txt

Note: Due to a currently unresolved pip error, the following packages are required to be installed manually:

  • Tensorflow
  • Skyfield
  • numpy
  • flwr
  • pandas

FLOMPS

The FLOMPS simulation workflow accepts a TLE file and simulates satellite adjacency, parameter server delegation and runs a mock Federated Learning cycle. Modules can be run independently as standalone functionality, or together in sequence for an end-to-end simulation pipeline.

Note: FL does not run in a decentralised server mode to support the FLOMPS algorithm at this stage and Satellite Simulator GUI mode is currently unsupported.

CLI Format

python main.py flomps [TLE file] [options…]

Available Options

Module Options

  • --start-time [YY:MM:DD HH:MM:SS]: Specifies the simulation start time.
  • -- end-time [YY:MM:DD HH:MM:SS]: Sets the simulation end time.
  • --timestep [int minutes]: Time interval for satellite updates in minutes.
  • --num-clients [int]: Number of federated learning clients (not required for end-to-end simulation pipeline).
  • --num-rounds [int]: Number of federated learning training rounds.
  • --model-type ["ResNet50", "SimpleCNN"]: The machine learning model to use for federated learning (SimpleCNN recommended for testing).
  • --data-set ["MNIST"]: The dataset for training the model.

Workflow Options --sat-sim-only: Run the Satellite Simulator on its own, requires a TLE file (currently accepts .txt file format). --algorithm: Run the FLOMPS Algorithm on its own, requires an Adjacency Matrix file. --fl-only: Run Federated Learning (FL) on its own. (Beta-Mode) Use --num-clients to specify client count along with a dummy input file to purely test FL.

NOTE: Argument options must use dashes e.g. --start-time. Argparse automatically stores the dash input format as the JSON format (--start-time -> start_time).

Notes

  • Further commands available in JSON for manual configuration of Satellite Simulator, Algorithm and Federated Learning modules.
  • Note about required options: These options are required to run FLOMPS. However, due to the program reading the JSON options file, these are likely already specified. Review the JSON options file to define pre-sets. Then, options provided in the command line can be instance specific for running simulations on the fly.

Configuration Using options.json

In addition to the CLI options, FLOMPS relies on an options.json file to define more detailed settings. This file allows the user to pre-configure the satellite simulation, algorithm behaviour, and federated learning settings.

Structure of options.json

The JSON file is structured into three main sections:

Satellite Simulation (sat_sim)

Configures parameters like the simulation's start and end times, time step for updates, and the number and type of satellites. Example:

"sat_sim": {
    "start_time": "2024-09-24 12:00:00",
    "end_time": "2024-09-24 14:00:00",
    "timestep": 60,
    "ground_station": {
        "location": {
            "lat": 35.6895,
            "long": 139.6917
        }
    }
}
Algorithm Configuration (algorithm)

Choosing to return algorithm output in a file. Example:

"algorithm": {
    "module_settings": {
        "output_to_file": true
    }
}
Federated Learning (federated_learning)

Defines federated learning parameters such as the number of training rounds, clients, model type, dataset, timing (tick) configuration & round configuration. Example:

"federated_learning": {
    "num_rounds": 1,
    "num_clients": 4,
    "model_type": "ResNet50",
    "data_set": "MNIST",
    "tick": {
        "tick_configuration": {
            "tick_behavior": "Adaptive",
            "tick_overflow": 0.2,
            "tick_underflow": 0.1
        },
        "round_configuration": {
            "expected_round_time": 15,
            "expected_training_time": 10,
            "expected_aggregation_time": 5
        }
    }
}

Examples

End-to-End Simulation 24-hour cycle

python main.py flomps TLEs/SatCount4.tle --start-time "2024-09-25 12:00:00" --end-time "2024-09-26 12:00:00" --timestep 60 --num-rounds 4

Run Standalone Module Where "output.txt" is a previously generated Adjacency Matrix produced by the Satellite Simulator

python main.py flomps output.txt --algorithm-only