# stefan-korner/spacepylibrary architecture

> Architecture diagram of the GitHub repository stefan-korner/spacepylibrary, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stefan-korner/spacepylibrary
- Repository: https://github.com/stefan-korner/spacepylibrary

## Overview

SpacePyLibrary is a Python aerospace library whose modules cover CCSDS/PUS data units, mission telecommand and telemetry handling, ground/link interfaces, simulation, and operator interfaces. The tree and source index support a broad workflow from packet and command construction through transport and spacecraft/simulation handling, with UI modules for configuration and monitoring. The README does not document one prescribed application workflow; some links below are therefore limited to imports documented in the source index, and unsampled subsystems are represented only where the index or tree supports them.

Main entry points: [`MC/TCGEN.py`](https://github.com/stefan-korner/spacepylibrary/blob/master/MC/TCGEN.py) (Telecommand generation), [`SIM.py`](https://github.com/stefan-korner/spacepylibrary/blob/master/SIM.py) (Simulation application), [`SPACE/ASW.py`](https://github.com/stefan-korner/spacepylibrary/blob/master/SPACE/ASW.py) (Spacecraft applications), [`MCUI/TCgui.py`](https://github.com/stefan-korner/spacepylibrary/blob/master/MCUI/TCgui.py) (Telecommand GUI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_protocol["Protocol data"]
  node_utildu["Binary data units<br/>[DU.py]"]
  node_ccsdsdu["CCSDS data units<br/>[DU.py]"]
  node_ccsdspacket["CCSDS packets<br/>[PACKET.py]"]
  node_ccdstime["CCSDS time formats<br/>[TIME.py]"]
  node_puspacket["PUS packets<br/>[PACKET.py]"]
  node_pusservices["PUS services<br/>[SERVICES.py]"]
  node_frameassembly["Frame and packet assembly"]
end

subgraph group_ground["Ground and transport"]
  node_groundif["Ground interface<br/>[IF.py]"]
  node_nctrs["NCTRS transport<br/>[NCTRS.py]"]
  node_nctrsdu["NCTRS data units<br/>[NCTRSDU.py]"]
  node_linktm["TM/TC link<br/>[TMTC.py]"]
  node_egse["EGSE interfaces<br/>[IF.py]"]
  node_cnc["CNC transport<br/>[CNC.py]"]
  node_eden["EDEN transport<br/>[EDEN.py]"]
end

subgraph group_mission["Mission and simulation"]
  node_mcif["Mission control interface<br/>[IF.py]"]
  node_tcgen["Telecommand generation<br/>[TCGEN.py]"]
  node_spaceif["Spacecraft interface<br/>[IF.py]"]
  node_asw["Spacecraft applications<br/>[ASW.py]"]
  node_simulation["Simulation application<br/>[SIM.py]"]
  node_supp["Mission definitions<br/>[IF.py]"]
  node_mib["SCOS mission database<br/>[MIB.py]"]
end

subgraph group_operator["Operator interfaces"]
  node_task["Task runtime<br/>[TASK.py]"]
  node_tki["Tk interface framework<br/>[TKI.py]"]
  node_tcgui["Telecommand GUI<br/>[TCgui.py]"]
  node_spacegui["Spacecraft GUI<br/>[SPACEgui.py]"]
  node_vp["Variable parameters<br/>[VP.py]"]
end

node_actor(("Operator or client"))

node_ccsdsdu -->|"extends binary units"| node_utildu
node_ccsdsdu -->|"converts timestamps"| node_ccdstime
node_ccsdspacket -->|"builds packets on"| node_ccsdsdu
node_puspacket -->|"specializes packets"| node_ccsdspacket
node_pusservices -->|"uses packet definitions"| node_ccsdspacket
node_frameassembly -->|"supports link framing"| node_linktm
node_linktm -->|"uses ground interface"| node_groundif
node_linktm -->|"uses spacecraft interface"| node_spaceif
node_nctrs -->|"implements interface"| node_groundif
node_nctrs -->|"uses data units"| node_nctrsdu
node_cnc -->|"implements interface"| node_egse
node_eden -->|"implements interface"| node_egse
node_tcgen -->|"uses mission interface"| node_mcif
node_tcgen -->|"constructs PUS packets"| node_puspacket
node_tcgen -->|"uses service definitions"| node_pusservices
node_tcgen -->|"uses mission definitions"| node_supp
node_asw -->|"implements spacecraft behavior"| node_spaceif
node_asw -->|"handles PUS packets"| node_puspacket
node_asw -->|"uses service definitions"| node_pusservices
node_mib -.->|"supplies mission definitions"| node_supp
node_simulation -->|"uses ground data units"| node_nctrsdu
node_simulation -->|"uses link stack"| node_linktm
node_simulation -->|"uses spacecraft interface"| node_spaceif
node_simulation -.->|"hosts spacecraft behavior"| node_asw
node_task -->|"updates registered views"| node_tki
node_tcgui -->|"uses mission interface"| node_mcif
node_tcgui -->|"uses variable parameters"| node_vp
node_tcgui -->|"uses GUI framework"| node_tki
node_spacegui -->|"uses spacecraft interface"| node_spaceif
node_spacegui -->|"uses variable parameters"| node_vp
node_spacegui -->|"uses GUI framework"| node_tki
node_actor -.->|"operates commands"| node_tcgui
node_actor -.->|"monitors spacecraft"| node_spacegui

click node_utildu "https://github.com/stefan-korner/spacepylibrary/blob/master/UTIL/DU.py"
click node_ccsdsdu "https://github.com/stefan-korner/spacepylibrary/blob/master/CCSDS/DU.py"
click node_ccsdspacket "https://github.com/stefan-korner/spacepylibrary/blob/master/CCSDS/PACKET.py"
click node_ccdstime "https://github.com/stefan-korner/spacepylibrary/blob/master/CCSDS/TIME.py"
click node_puspacket "https://github.com/stefan-korner/spacepylibrary/blob/master/PUS/PACKET.py"
click node_pusservices "https://github.com/stefan-korner/spacepylibrary/blob/master/PUS/SERVICES.py"
click node_frameassembly "https://github.com/stefan-korner/spacepylibrary/tree/master/CCSDS"
click node_groundif "https://github.com/stefan-korner/spacepylibrary/blob/master/GRND/IF.py"
click node_nctrs "https://github.com/stefan-korner/spacepylibrary/blob/master/GRND/NCTRS.py"
click node_nctrsdu "https://github.com/stefan-korner/spacepylibrary/blob/master/GRND/NCTRSDU.py"
click node_linktm "https://github.com/stefan-korner/spacepylibrary/blob/master/LINK/TMTC.py"
click node_egse "https://github.com/stefan-korner/spacepylibrary/blob/master/EGSE/IF.py"
click node_cnc "https://github.com/stefan-korner/spacepylibrary/blob/master/EGSE/CNC.py"
click node_eden "https://github.com/stefan-korner/spacepylibrary/blob/master/EGSE/EDEN.py"
click node_mcif "https://github.com/stefan-korner/spacepylibrary/blob/master/MC/IF.py"
click node_tcgen "https://github.com/stefan-korner/spacepylibrary/blob/master/MC/TCGEN.py"
click node_spaceif "https://github.com/stefan-korner/spacepylibrary/blob/master/SPACE/IF.py"
click node_asw "https://github.com/stefan-korner/spacepylibrary/blob/master/SPACE/ASW.py"
click node_simulation "https://github.com/stefan-korner/spacepylibrary/blob/master/SIM.py"
click node_supp "https://github.com/stefan-korner/spacepylibrary/blob/master/SUPP/IF.py"
click node_mib "https://github.com/stefan-korner/spacepylibrary/blob/master/SCOS/MIB.py"
click node_task "https://github.com/stefan-korner/spacepylibrary/blob/master/UTIL/TASK.py"
click node_tki "https://github.com/stefan-korner/spacepylibrary/blob/master/UI/TKI.py"
click node_tcgui "https://github.com/stefan-korner/spacepylibrary/blob/master/MCUI/TCgui.py"
click node_spacegui "https://github.com/stefan-korner/spacepylibrary/blob/master/SPACEUI/SPACEgui.py"
click node_vp "https://github.com/stefan-korner/spacepylibrary/blob/master/PUS/VP.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_utildu,node_ccsdsdu,node_ccsdspacket,node_ccdstime,node_puspacket,node_pusservices,node_frameassembly,node_actor toneBlue
class node_groundif,node_nctrs,node_nctrsdu,node_linktm,node_egse,node_cnc,node_eden toneAmber
class node_mcif,node_tcgen,node_spaceif,node_asw,node_simulation,node_supp,node_mib toneMint
class node_task,node_tki,node_tcgui,node_spacegui,node_vp toneRose
```

## Components

### Protocol data

- [Binary data units](https://github.com/stefan-korner/spacepylibrary/blob/master/UTIL/DU.py): `UTIL/DU.py`
- [CCSDS data units](https://github.com/stefan-korner/spacepylibrary/blob/master/CCSDS/DU.py): `CCSDS/DU.py`
- [CCSDS packets](https://github.com/stefan-korner/spacepylibrary/blob/master/CCSDS/PACKET.py): `CCSDS/PACKET.py`
- [CCSDS time formats](https://github.com/stefan-korner/spacepylibrary/blob/master/CCSDS/TIME.py): `CCSDS/TIME.py`
- [PUS packets](https://github.com/stefan-korner/spacepylibrary/blob/master/PUS/PACKET.py): `PUS/PACKET.py`
- [PUS services](https://github.com/stefan-korner/spacepylibrary/blob/master/PUS/SERVICES.py): `PUS/SERVICES.py`
- [Frame and packet assembly](https://github.com/stefan-korner/spacepylibrary/tree/master/CCSDS): `CCSDS`

### Ground and transport

- [Ground interface](https://github.com/stefan-korner/spacepylibrary/blob/master/GRND/IF.py): `GRND/IF.py`
- [NCTRS transport](https://github.com/stefan-korner/spacepylibrary/blob/master/GRND/NCTRS.py): `GRND/NCTRS.py`
- [NCTRS data units](https://github.com/stefan-korner/spacepylibrary/blob/master/GRND/NCTRSDU.py): `GRND/NCTRSDU.py`
- [TM/TC link](https://github.com/stefan-korner/spacepylibrary/blob/master/LINK/TMTC.py): `LINK/TMTC.py`
- [EGSE interfaces](https://github.com/stefan-korner/spacepylibrary/blob/master/EGSE/IF.py): `EGSE/IF.py`
- [CNC transport](https://github.com/stefan-korner/spacepylibrary/blob/master/EGSE/CNC.py): `EGSE/CNC.py`
- [EDEN transport](https://github.com/stefan-korner/spacepylibrary/blob/master/EGSE/EDEN.py): `EGSE/EDEN.py`

### Mission and simulation

- [Mission control interface](https://github.com/stefan-korner/spacepylibrary/blob/master/MC/IF.py): `MC/IF.py`
- [Telecommand generation](https://github.com/stefan-korner/spacepylibrary/blob/master/MC/TCGEN.py): `MC/TCGEN.py`
- [Spacecraft interface](https://github.com/stefan-korner/spacepylibrary/blob/master/SPACE/IF.py): `SPACE/IF.py`
- [Spacecraft applications](https://github.com/stefan-korner/spacepylibrary/blob/master/SPACE/ASW.py): `SPACE/ASW.py`
- [Simulation application](https://github.com/stefan-korner/spacepylibrary/blob/master/SIM.py): `SIM.py`
- [Mission definitions](https://github.com/stefan-korner/spacepylibrary/blob/master/SUPP/IF.py): `SUPP/IF.py`
- [SCOS mission database](https://github.com/stefan-korner/spacepylibrary/blob/master/SCOS/MIB.py): `SCOS/MIB.py`

### Operator interfaces

- [Task runtime](https://github.com/stefan-korner/spacepylibrary/blob/master/UTIL/TASK.py): `UTIL/TASK.py`
- [Tk interface framework](https://github.com/stefan-korner/spacepylibrary/blob/master/UI/TKI.py): `UI/TKI.py`
- [Telecommand GUI](https://github.com/stefan-korner/spacepylibrary/blob/master/MCUI/TCgui.py): `MCUI/TCgui.py`
- [Spacecraft GUI](https://github.com/stefan-korner/spacepylibrary/blob/master/SPACEUI/SPACEgui.py): `SPACEUI/SPACEgui.py`
- [Variable parameters](https://github.com/stefan-korner/spacepylibrary/blob/master/PUS/VP.py): `PUS/VP.py`

### Other components

- **Operator or client**

## Connections

- CCSDS data units → Binary data units: extends binary units (evidence: `CCSDS/DU.py`)
- CCSDS data units → CCSDS time formats: converts timestamps (evidence: `CCSDS/DU.py`)
- CCSDS packets → CCSDS data units: builds packets on (evidence: `CCSDS/PACKET.py`)
- PUS packets → CCSDS packets: specializes packets (evidence: `PUS/PACKET.py`)
- PUS services → CCSDS packets: uses packet definitions (evidence: `PUS/SERVICES.py`)
- Frame and packet assembly → TM/TC link: supports link framing (evidence: `LINK/TMTC.py`)
- TM/TC link → Ground interface: uses ground interface (evidence: `LINK/TMTC.py`)
- TM/TC link → Spacecraft interface: uses spacecraft interface (evidence: `LINK/TMTC.py`)
- NCTRS transport → Ground interface: implements interface (evidence: `GRND/NCTRS.py`)
- NCTRS transport → NCTRS data units: uses data units (evidence: `GRND/NCTRS.py`)
- CNC transport → EGSE interfaces: implements interface (evidence: `EGSE/CNC.py`)
- EDEN transport → EGSE interfaces: implements interface (evidence: `EGSE/EDEN.py`)
- Telecommand generation → Mission control interface: uses mission interface (evidence: `MC/TCGEN.py`)
- Telecommand generation → PUS packets: constructs PUS packets (evidence: `MC/TCGEN.py`)
- Telecommand generation → PUS services: uses service definitions (evidence: `MC/TCGEN.py`)
- Telecommand generation → Mission definitions: uses mission definitions (evidence: `MC/TCGEN.py`)
- Spacecraft applications → Spacecraft interface: implements spacecraft behavior (evidence: `SPACE/ASW.py`)
- Spacecraft applications → PUS packets: handles PUS packets (evidence: `SPACE/ASW.py`)
- Spacecraft applications → PUS services: uses service definitions (evidence: `SPACE/ASW.py`)
- SCOS mission database → Mission definitions: supplies mission definitions
- Simulation application → NCTRS data units: uses ground data units (evidence: `SIM.py`)
- Simulation application → TM/TC link: uses link stack (evidence: `SIM.py`)
- Simulation application → Spacecraft interface: uses spacecraft interface (evidence: `SIM.py`)
- Simulation application → Spacecraft applications: hosts spacecraft behavior
- Task runtime → Tk interface framework: updates registered views (evidence: `UI/TKI.py`)
- Telecommand GUI → Mission control interface: uses mission interface (evidence: `MCUI/TCgui.py`)
- Telecommand GUI → Variable parameters: uses variable parameters (evidence: `MCUI/TCgui.py`)
- Telecommand GUI → Tk interface framework: uses GUI framework (evidence: `MCUI/TCgui.py`)
- Spacecraft GUI → Spacecraft interface: uses spacecraft interface (evidence: `SPACEUI/SPACEgui.py`)
- Spacecraft GUI → Variable parameters: uses variable parameters (evidence: `SPACEUI/SPACEgui.py`)
- Spacecraft GUI → Tk interface framework: uses GUI framework (evidence: `SPACEUI/SPACEgui.py`)
- Operator or client → Telecommand GUI: operates commands
- Operator or client → Spacecraft GUI: monitors spacecraft
