# jsbsim-team/jsbsim architecture

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

- Interactive diagram: https://gitdiagram.com/jsbsim-team/jsbsim
- Repository: https://github.com/jsbsim-team/jsbsim

## Overview

1. **Repository purpose**
   JSBSim is a reusable **flight dynamics model (FDM)** written in C++. The core product is a simulation engine that computes aircraft/vehicle motion from forces, moments, environment, and control inputs. The repo also packages executable frontends, bindings, sample aircraft models, and integration layers.

2. **Core runtime center**
   The main orchestration class is `FGFDMExec` in `src/`. It acts as the simulation controller: it loads aircraft/system definitions, runs initialization, advances the simulation loop, and coordinates the model subsystems each timestep. Both the standalone executable and the language bindings ultimately drive this same engine.

3. **Physics/model subsystems**
   The simulation is split into model families under `src/models/`:
   - aerodynamics
   - atmosphere and winds
   - propulsion
   - mass/inertia
   - ground reactions / landing gear
   - flight control system
   - propagation / kinematics
   - auxiliary forces and external reactions  
   These modules exchange state through the property system rather than directly coupling all components.

4. **Property-driven data flow**
   A key architectural boundary is the **property tree** implemented in `src/input_output/FGPropertyManager.*`. Models read and write named properties, which lets XML-defined aircraft systems and runtime code communicate without hardwired dependencies. This is the main internal data bus for the simulation.

5. **XML model/configuration layer**
   Aircraft, engines, systems, and run scripts are defined in XML. The loader/parser code in `src/input_output/` reads:
   - aircraft definitions
   - engine models
   - flight control/system definitions
   - initial conditions and scripts  
   The repository root contains large model libraries in `aircraft/`, `engine/`, `systems/`, and `scripts/`, which are the primary inputs to the simulator.

6. **Initialization and trim/analysis**
   The `src/initialization/` subtree contains the logic for **initial conditions, trimming, linearization, and simplex-based trim search**. This is a distinct phase before normal time stepping. In the simulation flow, initialization resolves a consistent starting state; trim and linearization are analysis utilities built on the same model/property infrastructure.

7. **Math and geometry support**
   The `src/math/` layer provides reusable numerical primitives: vectors, matrices, quaternions, tables, functions, interpolation, Runge-Kutta integration, and optimization. `src/GeographicLib/` and parts of `src/simgear/` provide Earth/geodesy, XML, path, and utility support that the FDM depends on.

8. **Input/output and external interfaces**
   `src/input_output/` contains the non-physics boundaries:
   - file logging and output formatting
   - socket/UDP input and output
   - FlightGear-specific output
   - script execution
   - XML parsing and model loading  
   This is where the simulation connects to external consumers such as visualizers, test harnesses, or other simulators.

9. **Top-level executables and tools**
   The repo builds a standalone JSBSim console executable from `src/JSBSim.cpp` and also includes `utils/aeromatic++`, a separate utility for generating aircraft definitions from a questionnaire-style workflow. `utils/simplot` is another companion tool for plotting/processing simulation outputs.

10. **Language bindings and integration targets**
   The same core engine is exposed through several integration layers:
   - `python/`: Python module and wrapper scripts
   - `matlab/`: MATLAB/Simulink S-Function interface
   - `julia/`: Julia bindings
   - `UnrealEngine/Plugins/JSBSimFlightDynamicsModel/`: Unreal Engine plugin and reference app  
   These are thin integration shells around the C++ core, not separate simulators.

11. **Unreal Engine architecture slice**
   The `UnrealEngine/` subtree is a self-contained Unreal project. It combines:
   - the JSBSim plugin
   - Unreal game source (`UEReferenceApp`)
   - content assets for aircraft, terrain, effects, and UI  
   In this mode, JSBSim supplies the flight dynamics while Unreal supplies rendering, input, and scene management.

12. **Validation and regression structure**
   `tests/` and `check_cases/` provide automated verification. The repo includes both:
   - unit-style tests for math, physics components, and parsing
   - scenario/regression cases with aircraft data, scripts, and expected outputs  
   This shows the architecture is designed to validate individual model blocks and end-to-end simulation behavior.

13. **Build and packaging boundaries**
   The repo is organized around CMake, with additional project files for Visual Studio, packaging metadata, and CI workflows in `.github/`. The build produces multiple deliverables: native library/executable, Python wheels, MATLAB support artifacts, Unreal plugin assets, and platform packages.

14. **How the major data flows fit together**
   The dominant flow is: **XML model/script files → loader/property tree → model subsystems → outputs/logs/sockets**. Initialization and trim run before the main loop, while external integrations such as Python, Unreal, MATLAB, and FlightGear all connect through the same simulation core and output interfaces.

Main entry points: [`src/FGFDMExec.cpp`](https://github.com/jsbsim-team/jsbsim/blob/master/src/FGFDMExec.cpp) (FGFDMExec), [`src/input_output/FGModelLoader.cpp`](https://github.com/jsbsim-team/jsbsim/blob/master/src/input_output/FGModelLoader.cpp) (Loaders), [`src/models`](https://github.com/jsbsim-team/jsbsim/tree/master/src/models) (Model layer), [`src/input_output/FGPropertyManager.cpp`](https://github.com/jsbsim-team/jsbsim/blob/master/src/input_output/FGPropertyManager.cpp) (Property tree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core engine"]
  node_fgfdmexec["FGFDMExec<br/>simulation orchestrator<br/>[FGFDMExec.cpp]"]
  node_property_manager[("Property tree<br/>data bus")]
  node_model_layer["Model layer<br/>physics subsystems"]
  node_aero_atmo["Flight env<br/>aero+atmo models<br/>[FGAerodynamics.cpp]"]
  node_propulsion["Propulsion<br/>thrust models<br/>[FGEngine.cpp]"]
  node_fcs_ground["Controls & gear<br/>flight control+ground<br/>[FGFCSComponent.cpp]"]
  node_propagate["Propagation<br/>kinematics<br/>[FGPropagate.cpp]"]
  node_init_trim["Init & trim<br/>startup analysis"]
  node_loader_io["Loaders<br/>xml/model loading<br/>[FGModelLoader.cpp]"]
  node_outputs_io["Outputs<br/>logging+streams<br/>[FGOutputFile.cpp]"]
end

subgraph group_assets["Model data"]
  node_aircraft_lib["Aircraft<br/>XML models"]
  node_engine_lib["Engines"]
  node_systems_lib["Systems"]
  node_scripts_lib["Scripts"]
end

subgraph group_interfaces["Bindings & apps"]
  node_jsbsim_cli["JSBSim CLI<br/>console executable<br/>[JSBSim.cpp]"]
  node_python_bindings["Python<br/>language binding<br/>[JSBSim.py]"]
  node_matlab_bindings["MATLAB<br/>simulink binding"]
  node_julia_bindings["Julia<br/>language binding<br/>[JSBSim.jl]"]
  node_unreal_plugin["Unreal plugin<br/>game integration"]
  node_aeromatic_tool["Aeromatic++<br/>model generator<br/>[aeromatic.cpp]"]
  node_simplot_tool["Simplot<br/>plot tool<br/>[main.cpp]"]
end

subgraph group_validation["Validation"]
  node_tests_suite["Tests<br/>regression suite"]
  node_check_cases["Check cases<br/>scenario regressions"]
end

subgraph group_support["Support code"]
  node_math_support["Math core<br/>numerics"]
  node_geo_support["Geodesy<br/>earth math"]
  node_xml_support["XML utils<br/>parsing support"]
end

node_fgfdmexec -->|"reads/writes"| node_property_manager
node_fgfdmexec -->|"updates"| node_model_layer
node_model_layer -->|"includes"| node_aero_atmo
node_model_layer -->|"includes"| node_propulsion
node_model_layer -->|"includes"| node_fcs_ground
node_model_layer -->|"includes"| node_propagate
node_model_layer -->|"communicates via"| node_property_manager
node_init_trim -->|"configures"| node_fgfdmexec
node_loader_io -->|"populates"| node_property_manager
node_loader_io -->|"loads"| node_aircraft_lib
node_loader_io -->|"loads"| node_engine_lib
node_loader_io -->|"loads"| node_systems_lib
node_loader_io -->|"executes"| node_scripts_lib
node_outputs_io -->|"samples"| node_property_manager
node_jsbsim_cli -->|"drives"| node_fgfdmexec
node_python_bindings -->|"wraps"| node_fgfdmexec
node_matlab_bindings -->|"wraps"| node_fgfdmexec
node_julia_bindings -->|"wraps"| node_fgfdmexec
node_unreal_plugin -->|"embeds"| node_fgfdmexec
node_aeromatic_tool -.->|"generates"| node_aircraft_lib
node_simplot_tool -.->|"consumes"| node_outputs_io
node_tests_suite -->|"verifies"| node_fgfdmexec
node_tests_suite -->|"verifies"| node_property_manager
node_tests_suite -->|"verifies"| node_math_support
node_check_cases -->|"reuses"| node_scripts_lib
node_check_cases -->|"reuses"| node_aircraft_lib
node_check_cases -->|"compares"| node_outputs_io
node_propagate -->|"uses"| node_geo_support
node_loader_io -->|"uses"| node_xml_support

click node_fgfdmexec "https://github.com/jsbsim-team/jsbsim/blob/master/src/FGFDMExec.cpp"
click node_property_manager "https://github.com/jsbsim-team/jsbsim/blob/master/src/input_output/FGPropertyManager.cpp"
click node_model_layer "https://github.com/jsbsim-team/jsbsim/tree/master/src/models"
click node_aero_atmo "https://github.com/jsbsim-team/jsbsim/blob/master/src/models/FGAerodynamics.cpp"
click node_propulsion "https://github.com/jsbsim-team/jsbsim/blob/master/src/models/propulsion/FGEngine.cpp"
click node_fcs_ground "https://github.com/jsbsim-team/jsbsim/blob/master/src/models/flight_control/FGFCSComponent.cpp"
click node_propagate "https://github.com/jsbsim-team/jsbsim/blob/master/src/models/FGPropagate.cpp"
click node_init_trim "https://github.com/jsbsim-team/jsbsim/blob/master/src/initialization/FGInitialCondition.cpp"
click node_loader_io "https://github.com/jsbsim-team/jsbsim/blob/master/src/input_output/FGModelLoader.cpp"
click node_outputs_io "https://github.com/jsbsim-team/jsbsim/blob/master/src/input_output/FGOutputFile.cpp"
click node_math_support "https://github.com/jsbsim-team/jsbsim/tree/master/src/math"
click node_geo_support "https://github.com/jsbsim-team/jsbsim/tree/master/src/GeographicLib"
click node_xml_support "https://github.com/jsbsim-team/jsbsim/tree/master/src/simgear/xml"
click node_aircraft_lib "https://github.com/jsbsim-team/jsbsim/tree/master/aircraft"
click node_engine_lib "https://github.com/jsbsim-team/jsbsim/tree/master/engine"
click node_systems_lib "https://github.com/jsbsim-team/jsbsim/tree/master/systems"
click node_scripts_lib "https://github.com/jsbsim-team/jsbsim/tree/master/scripts"
click node_tests_suite "https://github.com/jsbsim-team/jsbsim/tree/master/tests"
click node_check_cases "https://github.com/jsbsim-team/jsbsim/tree/master/check_cases"
click node_jsbsim_cli "https://github.com/jsbsim-team/jsbsim/blob/master/src/JSBSim.cpp"
click node_python_bindings "https://github.com/jsbsim-team/jsbsim/blob/master/python/JSBSim.py"
click node_matlab_bindings "https://github.com/jsbsim-team/jsbsim/blob/master/matlab/JSBSimInterface.cpp"
click node_julia_bindings "https://github.com/jsbsim-team/jsbsim/blob/master/julia/JSBSim.jl"
click node_unreal_plugin "https://github.com/jsbsim-team/jsbsim/blob/master/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp"
click node_aeromatic_tool "https://github.com/jsbsim-team/jsbsim/blob/master/utils/aeromatic++/aeromatic.cpp"
click node_simplot_tool "https://github.com/jsbsim-team/jsbsim/blob/master/utils/simplot/main.cpp"

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_fgfdmexec,node_property_manager,node_model_layer,node_aero_atmo,node_propulsion,node_fcs_ground,node_propagate,node_init_trim,node_loader_io,node_outputs_io toneBlue
class node_aircraft_lib,node_engine_lib,node_systems_lib,node_scripts_lib toneAmber
class node_jsbsim_cli,node_python_bindings,node_matlab_bindings,node_julia_bindings,node_unreal_plugin,node_aeromatic_tool,node_simplot_tool toneMint
class node_tests_suite,node_check_cases toneRose
class node_math_support,node_geo_support,node_xml_support toneIndigo
```

## Components

### Core engine

Simulation controller, property bus, model subsystems, and initialization phases.

- [FGFDMExec](https://github.com/jsbsim-team/jsbsim/blob/master/src/FGFDMExec.cpp): simulation orchestrator · Central simulation controller that loads models, initializes state, and advances the timestep loop. · `src/FGFDMExec.cpp`
- [Property tree](https://github.com/jsbsim-team/jsbsim/blob/master/src/input_output/FGPropertyManager.cpp): data bus · Named property system used by models, loaders, and external interfaces to exchange state. · `src/input_output/FGPropertyManager.cpp`
- [Model layer](https://github.com/jsbsim-team/jsbsim/tree/master/src/models): physics subsystems · Main FDM subsystems for aerodynamics, atmosphere, propulsion, mass, ground, control, and propagation. · `src/models`
- [Flight env](https://github.com/jsbsim-team/jsbsim/blob/master/src/models/FGAerodynamics.cpp): aero+atmo models · Aerodynamics, atmosphere, winds, auxiliary forces, buoyancy, and external reactions. · `src/models/FGAerodynamics.cpp`
- [Propulsion](https://github.com/jsbsim-team/jsbsim/blob/master/src/models/propulsion/FGEngine.cpp): thrust models · Engine, propeller, turbine, piston, electric, rocket, nozzle, tank, and transmission models. · `src/models/propulsion/FGEngine.cpp`
- [Controls & gear](https://github.com/jsbsim-team/jsbsim/blob/master/src/models/flight_control/FGFCSComponent.cpp): flight control+ground · Flight control system components plus ground reactions, landing gear, and aircraft surfaces. · `src/models/flight_control/FGFCSComponent.cpp`
- [Propagation](https://github.com/jsbsim-team/jsbsim/blob/master/src/models/FGPropagate.cpp): kinematics · Vehicle state propagation, inertial state, accelerations, and mass balance updates. · `src/models/FGPropagate.cpp`
- [Init & trim](https://github.com/jsbsim-team/jsbsim/blob/master/src/initialization/FGInitialCondition.cpp): startup analysis · Initial conditions, trimming, linearization, and trim search before the normal simulation loop. · `src/initialization/FGInitialCondition.cpp`
- [Loaders](https://github.com/jsbsim-team/jsbsim/blob/master/src/input_output/FGModelLoader.cpp): xml/model loading · XML parsing, model loading, scripts, and file readers that build simulation state from definitions. · `src/input_output/FGModelLoader.cpp`
- [Outputs](https://github.com/jsbsim-team/jsbsim/blob/master/src/input_output/FGOutputFile.cpp): logging+streams · File logs, formatted outputs, sockets, UDP I/O, and FlightGear-oriented output adapters. · `src/input_output/FGOutputFile.cpp`

### Model data

XML aircraft, engines, systems, scripts, and regression cases used by the simulator.

- [Aircraft](https://github.com/jsbsim-team/jsbsim/tree/master/aircraft): XML models · Aircraft definitions, reset states, and per-aircraft system/engine files consumed by the simulator. · `aircraft`
- [Engines](https://github.com/jsbsim-team/jsbsim/tree/master/engine): XML engines · Reusable engine and propeller XML definitions shared across aircraft models. · `engine`
- [Systems](https://github.com/jsbsim-team/jsbsim/tree/master/systems): XML systems · Reusable systems definitions such as autopilot, gear, sensors, and control logic. · `systems`
- [Scripts](https://github.com/jsbsim-team/jsbsim/tree/master/scripts): run scripts · Scenario and mission scripts that drive initialization, control inputs, and regression runs. · `scripts`

### Bindings & apps

Executable frontends and language/runtime integrations around the C++ core.

- [JSBSim CLI](https://github.com/jsbsim-team/jsbsim/blob/master/src/JSBSim.cpp): console executable · Standalone command-line frontend that drives the simulation core. · `src/JSBSim.cpp`
- [Python](https://github.com/jsbsim-team/jsbsim/blob/master/python/JSBSim.py): language binding · Python module and wrappers exposing the core simulation engine to Python code. · `python/JSBSim.py`
- [MATLAB](https://github.com/jsbsim-team/jsbsim/blob/master/matlab/JSBSimInterface.cpp): simulink binding · MATLAB/Simulink interface and S-Function wrapper around the C++ engine. · `matlab/JSBSimInterface.cpp`
- [Julia](https://github.com/jsbsim-team/jsbsim/blob/master/julia/JSBSim.jl): language binding · Julia wrapper exposing JSBSim functionality through a native extension. · `julia/JSBSim.jl`
- [Unreal plugin](https://github.com/jsbsim-team/jsbsim/blob/master/UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp): game integration · Unreal Engine plugin and reference app that consume the JSBSim core for flight dynamics. · `UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp`
- [Aeromatic++](https://github.com/jsbsim-team/jsbsim/blob/master/utils/aeromatic++/aeromatic.cpp): model generator · Aircraft definition generator used to create or prototype JSBSim aircraft XML models. · `utils/aeromatic++/aeromatic.cpp`
- [Simplot](https://github.com/jsbsim-team/jsbsim/blob/master/utils/simplot/main.cpp): plot tool · Post-processing and plotting companion for simulation output files. · `utils/simplot/main.cpp`

### Validation

Automated checks and scenario-based regression coverage.

- [Tests](https://github.com/jsbsim-team/jsbsim/tree/master/tests): regression suite · Python and C++ validation coverage for components, loading, trim, outputs, and scenario behavior. · `tests`
- [Check cases](https://github.com/jsbsim-team/jsbsim/tree/master/check_cases): scenario regressions · End-to-end regression inputs and expected outputs for representative flight and ground cases. · `check_cases`

### Support code

Reusable math, geodesy, XML, and utility infrastructure.

- [Math core](https://github.com/jsbsim-team/jsbsim/tree/master/src/math): numerics · Vectors, matrices, quaternions, tables, interpolation, Runge-Kutta, state-space, and optimization. · `src/math`
- [Geodesy](https://github.com/jsbsim-team/jsbsim/tree/master/src/GeographicLib): earth math · Geographic and Earth-model helpers used by propagation and location calculations. · `src/GeographicLib`
- [XML utils](https://github.com/jsbsim-team/jsbsim/tree/master/src/simgear/xml): parsing support · Embedded XML and utility support used by model loading and configuration processing. · `src/simgear/xml`

## Connections

- FGFDMExec → Property tree: reads/writes · Simulation state is exchanged through the property tree.
- FGFDMExec → Model layer: updates · The engine steps all physics and control subsystems each timestep.
- Model layer → Flight env: includes · Aerodynamic and environment-related force models.
- Model layer → Propulsion: includes · Engine and thrust generation models.
- Model layer → Controls & gear: includes · Control-system and landing-gear related models.
- Model layer → Propagation: includes · State propagation and inertial integration models.
- Model layer → Property tree: communicates via · Subsystems coordinate through named properties instead of direct coupling.
- Init & trim → FGFDMExec: configures · Initialization and trim phases prepare the engine before the main run loop.
- Loaders → Property tree: populates · XML loaders create and initialize the property tree.
- Loaders → Aircraft: loads · Aircraft definitions are parsed into simulation models.
- Loaders → Engines: loads · Engine XML feeds propulsion models.
- Loaders → Systems: loads · System XML feeds control and subsystem definitions.
- Loaders → Scripts: executes · Scenario scripts drive initialization and runtime commands.
- Outputs → Property tree: samples · Outputs and logs read simulation properties for export.
- JSBSim CLI → FGFDMExec: drives · Standalone executable runs the core simulation controller.
- Python → FGFDMExec: wraps · Python API connects to the same C++ core.
- MATLAB → FGFDMExec: wraps · MATLAB/Simulink interface uses the shared simulation engine.
- Julia → FGFDMExec: wraps · Julia bindings expose the simulation core.
- Unreal plugin → FGFDMExec: embeds · Unreal integration embeds JSBSim as the flight dynamics backend.
- Aeromatic++ → Aircraft: generates · Aircraft generation tool produces JSBSim-style aircraft definitions.
- Simplot → Outputs: consumes · Plotting tool processes simulator output files.
- Tests → FGFDMExec: verifies · Tests exercise the engine, model loading, trim, and outputs.
- Tests → Property tree: verifies · Unit and integration checks cover property behavior.
- Tests → Math core: verifies · Math primitives and integrators are directly tested.
- Check cases → Scripts: reuses · Scenario regressions are driven by XML scripts.
- Check cases → Aircraft: reuses · Regression cases reuse aircraft and reset definitions.
- Check cases → Outputs: compares · Expected outputs are matched against logged simulation results.
- Propagation → Geodesy: uses · Propagation depends on geodesy and Earth location helpers.
- Loaders → XML utils: uses · XML parsing and utility support underpins model/config loading.
