Spaceflight Dynamics Framework Architecture
System Overview
The Spaceflight Dynamics Framework (SDF) is organized as a modular simulation application with explicit boundaries between the Qt frontend, the simulation worker, the interface layer, and the C++ simulation backend. Within the backend, simulation orchestration, spacecraft state, coordinate transformations, physics, propulsion, control, sensors, and numerical integration are represented by dedicated components. The current control architecture additionally contains dedicated automatic rotational control for angular-rate damping and quaternion attitude hold.
This page focuses on the concrete components, where they are located in the architecture, and which neighboring components they interact with. Runtime sequencing, state ownership over time, command timing, and the detailed movement of data through those components are documented separately on the SDF Runtime Data Flow page.
Architectural Layers
- Frontend / Application Layer: Qt-based UI components, page navigation, configuration selection, cockpit presentation, the simulation worker, telemetry history management, and XML export control.
- Interface Layer: DTOs and mapping components that form the stable software boundary between frontend-facing representations and backend domain types.
- Backend / Simulation Engine: Simulation orchestration, spacecraft state, coordinate systems, physics, propulsion, controllers, sensors, configuration interpretation, and numerical integration.
- Simulation Models: Replaceable implementations behind interfaces for physics, propulsion, control, sensing, integration, and research-oriented extensions.
Frontend and Application Architecture
The frontend is structured around MainWindow as the application shell. It owns the persistent navigation, the page stack, shared application services, and the simulation thread boundary. Individual pages remain focused UI components rather than simulation controllers.
SimulationWorker is the application-side boundary to the simulation thread. It is connected to the UI through Qt signals and slots and collaborates with the interface layer for command and telemetry translation. It also owns application-level simulation-session concerns such as telemetry history and export requests.
Scientific telemetry export is represented by the dedicatedTelemetryXmlExporter. The exporter is associated with the worker-side telemetry history and is responsible only for XML serialization. It does not belong to the physics backend and does not own simulation state.
Frontend and Application Components
- MainWindow: Central Qt application shell. It connects the top bar, page stack, configuration management, simulation thread, and
SimulationWorker. - TopBarWidget: Persistent application navigation and global controls. It is owned by
MainWindowand provides access to application-wide functions including telemetry export controls. - QStackedWidget: Page container owned by
MainWindowfor switching between the application pages. - Homepage: Landing page and navigation entry point. It does not own simulation infrastructure.
- SpacecraftSelectionPage: Configuration-selection UI that works with the shared
ConfigManager. - cockpitPage: Main simulation presentation page. It is connected to
SimulationWorkerfor telemetry and command exchange and contains cockpit-specific widgets. The cockpit exposes dedicated Kill Rotation and Stabilize controls for automatic rotational control. - ControlsHelpPage: Static user-facing control reference.
- SettingsPage: Application page reserved for the settings subsystem planned for the research-oriented release line.
- ConfigManager: Shared frontend/application service for selecting and supplying JSON spacecraft configurations.
- inputmapper: Cockpit-side input component that creates manual translational and rotational RCS commands. Automatic attitude-mode flags remain owned by the dedicated cockpit controls and are preserved when manual axis commands are updated.
- LandingView: Cockpit visualization component for landing geometry, trajectory, velocity, and RCS indication.
- UIBuilder: Shared helper for consistent frontend widgets, labels, controls, and telemetry presentation elements.
- SimulationWorker: Simulation-thread boundary and application coordinator for the active simulation session. It communicates with
cockpitPage/MainWindow, the interface layer, and telemetry recording/export components. - TelemetryXmlExporter: XML serialization component used by the worker-side export feature. It consumes recorded telemetry snapshots and writes the scientific telemetry document without depending on backend physics classes.
Interface Layer Architecture
The interface layer is the explicit software boundary between the Qt application and the backend domain model. It prevents frontend classes from depending directly on backend spacecraft, physics, propulsion, or frame structures.
Interface Components
- FlightCommandDTO: Frontend-facing command contract used by cockpit/input components and
SimulationWorker. In addition to manual engine and RCS commands, the DTO contains explicitkillRotationandstabilizemode requests. - TelemetryDTO: Frontend-facing telemetry contract used by cockpit visualization, worker-side recording, and XML export. It includes the active automatic attitude-control state so verification data can be associated unambiguously with Kill Rotation or Stabilize operation.
- TelemetryMapper: Translation component connecting DTOs with backend command and simulation-data structures. It is used by
SimulationWorkeron the application side and communicates withsimcontrol/simDataon the backend side.
The DTOs are value-oriented contracts rather than shared backend domain objects. This boundary can later be reused or adapted for additional transports such as ROS2 without coupling cockpit widgets to simulation-core classes.
Backend Architecture
The backend is a modular C++ simulation engine centered aroundspacecraft and its associated runtime state. The backend separates orchestration, configuration interpretation, coordinate handling, physical models, propulsion, integration, control, and sensing into distinct responsibilities.
Eigen provides the common mathematical foundation for vectors, matrices, and quaternions across the simulation core. Coordinate-system concerns are kept in dedicated context and transformation components rather than embedded in the UI or configuration layer.
Backend Core Components
- simcontrol: Backend orchestration component. It connects the interface boundary with the active
spacecraftinstance and coordinates backend subsystem participation in a simulation session. - spacecraft: Central backend domain object. It owns the authoritative
StateVectorand collaborates with propulsion, physics, mission/frame contexts, coordinate transformation, sensors, and configuration-derived vehicle data. - StateVector: Dynamic spacecraft-state container owned by
spacecraft. It provides the state consumed by physics, frame derivation, control, sensing, and telemetry aggregation. - MissionContext: Mission-reference component associated with
spacecraft. It contains persistent mission references such as the configured landing-site definition and the corresponding reference-frame representations. - SimulationFrameContext: Runtime frame-view component associated with
spacecraft. It groups the spacecraft state as represented in MCI, MCMF, MSC, ENU, LVLH, and SBF-related forms for consumers that require those representations. - CoordinateTransformer: Stateless/compute-oriented coordinate subsystem used by
spacecraftand frame-context construction for transformations between MCI, MCMF, MSC, ENU, LVLH, and SBF representations. - jsonConfigReader: Backend configuration interpreter. It creates backend configuration structures from external JSON and supplies spacecraft, propulsion, fuel, initial-state, and mission-reference data.
- customSpacecraft: Configuration-side spacecraft data model populated by
jsonConfigReaderand consumed during spacecraft construction/initialization. - simData: Backend-facing aggregate representation used at the interface boundary. It references state, frame, mission, propulsion, fuel, sensor, integrity, console, automatic attitude-control mode, and simulation-time information without exposing the complete
spacecraftobject to the frontend.
Backend Structural Relationships
simcontrolis the backend entry point used by the interface layer.simcontrolowns or manages the activespacecraftinstance.spacecraftis the hub connecting state, propulsion, physics, frames, and sensing.StateVector,MissionContext, andSimulationFrameContextremain distinct domain structures with different responsibilities.CoordinateTransformeris shared by frame-related backend components rather than duplicated across subsystems.simDataforms the backend side of the telemetry/interface boundary.
Physics Architecture
The physics subsystem contains the components responsible for translational and rotational rigid-body dynamics and the numerical integration interfaces used by the spacecraft model. Physical models, integration algorithms, and feedback-control components are intentionally represented by separate abstractions. Automatic attitude control remains outside the rigid-body equations and influences spacecraft motion only through the normal RCS actuation path.
Physics and Control Components
- IPhysicsModel: Abstract interface for translational environmental/acceleration models used by the physics subsystem.
- BasicMoonGravityModel: Current lunar gravity-model implementation behind the translational physics interface.
- IRotationalPhysicsModel: Interface for rotational rigid-body models.
- RigidBodyRotationalModel: Euler-equation-based rotational dynamics implementation used with spacecraft inertia and body angular state.
- IIntegrator: Numerical integration abstraction shared by translational, rotational, and quaternion state updates.
- EulerIntegrator: Current concrete implementation of
IIntegrator. - Dynamics: Coordination component connecting spacecraft state, physical models, applied loads, and the selected integrator.
- IController: Generic feedback-controller interface. In addition to scalar control operations, it exposes a quaternion-based three-axis control function used by the attitude-control subsystem.
- PD Controller: Concrete feedback-controller implementation used by both the descent-control architecture and the quaternion attitude controller. For attitude control, it combines quaternion-error feedback with body angular-rate damping.
- IAttitudeControl: Dedicated interface for automatic rotational-control modes. It separates the attitude-control contract from both simulation orchestration and the physical rigid-body model.
- AttitudeController: Concrete implementation of
IAttitudeControl. It provides Kill Rotationfor angular-rate damping and Stabilize for quaternion attitude hold. Stabilize captures the current orientation as its reference attitude and applies a hysteresis band around the settled state to reduce repeated RCS switching. - IAutopilot: Interface for automated guidance/control logic.
- Adaptive Descent Controller: Current automated descent controller connected to the main-engine control subsystem.
- InputArbiter: Control-authority component positioned between manual and automated command producers and the backend actuation path. Main engine, translational RCS, and rotational RCS authority can be resolved independently so automatic attitude control does not replace unrelated manual channels.
- ISensor / SensorModel: Sensor abstraction and concrete sensor components attached to the simulation state for telemetry and feedback consumers.
Structural Relationships
spacecraftuses the physics/dynamics subsystem for state propagation.Dynamicsconnects physics-model and integrator abstractions.- Propulsion supplies the loads consumed by the dynamics subsystem.
- Controllers and autopilot components are separated from the physical models and connect through the control architecture.
AttitudeControllerconsumes spacecraft attitude and angular velocity but does not directly modify theStateVector.- Automatic rotational commands are resolved by
InputArbiterbefore reaching the RCS actuation subsystem. - Sensor components observe simulation state without becoming state owners.
Propulsion Architecture
The propulsion subsystem models main engines, RCS thrusters, fuel assignment, actuator state, and propulsion-induced loads behind a common orchestration layer. Main-engine and RCS models are separate concrete implementations but share the IThrustModel abstraction where appropriate.
Propulsion Components
- Thrust Orchestrator: Central propulsion component owned or used by
spacecraft. It manages engine-model instances and forms the connection between spacecraft control requests, propulsion models, fuel, and the dynamics subsystem. - IThrustModel: Common engine-model interface exposing engine identity, command/state access, thrust, direction, torque, fuel consumption, and tank assignment.
- BasicMainEngineModel: Concrete main-engine model implementing the main propulsion actuator behavior.
- BasicRCSModel: Concrete model for an individual RCS thruster.
- RCSControlAllocator: RCS allocation component positioned between spacecraft control requests and individual RCS engine models. It is also the actuator-side consumer of automatic rotational commands generated by Kill Rotation or Stabilize.
- EngineConfig / RCSEngineConfig: Static configuration objects supplied from spacecraft configuration and associated with the corresponding engine-model instances.
- ME_ThrustState / RCS_ThrustState: Runtime propulsion-state structures associated with main-engine and RCS models and exposed to telemetry consumers.
- FuelTank / FuelState: Propellant-resource components shared by the configured propulsion models and spacecraft mass/fuel accounting.
Structural Relationships
spacecraftconnects the control side,Thrust, and the dynamics subsystem.Thrustowns/manages the concrete main-engine and RCS model instances.RCSControlAllocatoris specific to the RCS branch of the propulsion architecture.- Engine configurations are static inputs; thrust-state structures represent the corresponding runtime actuator state.
- Fuel components are referenced by propulsion models and spacecraft-level resource accounting.
Telemetry, Recording, and Export Architecture
Telemetry spans three architectural areas: backend aggregation, interface-layer translation, and frontend/application consumption. The components are deliberately separated so cockpit presentation and scientific export can use the same frontend-facing telemetry contract without depending directly on backend domain classes.
Telemetry Components and Connections
- simData: Backend aggregate attached to
spacecraft/simcontroland consumed by the interface layer. - TelemetryMapper: Interface-layer component connecting backend
simDatawith the frontend-facingTelemetryDTOrepresentation. - TelemetryDTO: Shared application-facing value contract used by
cockpitPage,SimulationWorkertelemetry history, and the export subsystem. The DTO contains explicit automation-state fields forkillRotationActiveandstabilizeActive. - SimulationWorker: Application-side owner of telemetry history and the connection point between simulation-thread telemetry, frontend presentation, and export requests.
- TelemetryXmlExporter: Dedicated serializer connected to the recorded telemetry history. It produces XML output while remaining separate from backend simulation and physics components.
- cockpitPage / LandingView: UI consumers connected to the worker-provided telemetry representation.
For snapshot timing, recording semantics, history handling, lifecycle behavior, and the detailed relationship between cockpit output and XML export, see Runtime Data Flow.
Optimization Components
The backend contains experimental optimization components based on NLopt. They are structurally separated from the real-time simulation loop and remain research-oriented extensions rather than dependencies of the core simulation architecture.
- OptimizationModelParams: Parameter container for optimization runs.
- OptimizationStruct: Data structure for optimization state and results.
- ThrustOptimizationProblem: Optimization problem formulation.
- ThrustOptimizer: NLopt-based optimization driver.
Architectural Design Principles
- Separation of Concerns: UI, application/session management, interface translation, backend orchestration, physics, propulsion, control, sensing, and export are represented by distinct components.
- Explicit Boundaries: DTOs and
TelemetryMapperisolate frontend/application code from backend domain structures. - Centralized Spacecraft Domain:
spacecraftis the backend hub for state and vehicle-specific subsystem composition, while supporting contexts remain separate domain structures. - Interface-Based Extensibility: Physics, rotational models, integrators, propulsion models, generic controllers, attitude-control implementations, autopilots, and sensors expose replaceable interfaces where appropriate.
- Configuration-Driven Composition: Spacecraft, mission, propulsion, fuel, and initial-state configuration are supplied externally and interpreted by dedicated configuration components.
- Dedicated Coordinate Subsystem: Frame transformations and mission/runtime frame representations remain explicit backend components.
- Reusable Telemetry Contract: Cockpit visualization, recording, and XML export share the same application-facing telemetry representation rather than creating independent simulation interfaces.
- Research Orientation: Optimization and future communication extensions can be attached without collapsing the existing subsystem boundaries.