How jsbsim-team/jsbsim works
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: FGFDMExec.cpp FGFDMExec · FGModelLoader.cpp Loaders · models Model layer · FGPropertyManager.cpp Property tree
Components 26
Core engine
Simulation controller, property bus, model subsystems, and initialization phases.
- FGFDMExec · Central simulation controller that loads models, initializes state, and advances the timestep loop.
src/FGFDMExec.cpp - Property tree · Named property system used by models, loaders, and external interfaces to exchange state.
src/input_output/FGPropertyManager.cpp - Model layer · Main FDM subsystems for aerodynamics, atmosphere, propulsion, mass, ground, control, and propagation.
src/models - Flight env · Aerodynamics, atmosphere, winds, auxiliary forces, buoyancy, and external reactions.
src/models/FGAerodynamics.cpp - Propulsion · Engine, propeller, turbine, piston, electric, rocket, nozzle, tank, and transmission models.
src/models/propulsion/FGEngine.cpp - Controls & gear · Flight control system components plus ground reactions, landing gear, and aircraft surfaces.
src/models/flight_control/FGFCSComponent.cpp - Propagation · Vehicle state propagation, inertial state, accelerations, and mass balance updates.
src/models/FGPropagate.cpp - Init & trim · Initial conditions, trimming, linearization, and trim search before the normal simulation loop.
src/initialization/FGInitialCondition.cpp - Loaders · XML parsing, model loading, scripts, and file readers that build simulation state from definitions.
src/input_output/FGModelLoader.cpp - Outputs · 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 · Aircraft definitions, reset states, and per-aircraft system/engine files consumed by the simulator.
aircraft - Engines · Reusable engine and propeller XML definitions shared across aircraft models.
engine - Systems · Reusable systems definitions such as autopilot, gear, sensors, and control logic.
systems - 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 · Standalone command-line frontend that drives the simulation core.
src/JSBSim.cpp - Python · Python module and wrappers exposing the core simulation engine to Python code.
python/JSBSim.py - MATLAB · MATLAB/Simulink interface and S-Function wrapper around the C++ engine.
matlab/JSBSimInterface.cpp - Julia · Julia wrapper exposing JSBSim functionality through a native extension.
julia/JSBSim.jl - Unreal plugin · Unreal Engine plugin and reference app that consume the JSBSim core for flight dynamics.
UnrealEngine/Plugins/JSBSimFlightDynamicsModel/Source/JSBSimFlightDynamicsModel/Private/JSBSimMovementComponent.cpp - Aeromatic++ · Aircraft definition generator used to create or prototype JSBSim aircraft XML models.
utils/aeromatic++/aeromatic.cpp - Simplot · Post-processing and plotting companion for simulation output files.
utils/simplot/main.cpp
Validation
Automated checks and scenario-based regression coverage.
- Tests · Python and C++ validation coverage for components, loading, trim, outputs, and scenario behavior.
tests - Check cases · 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 · Vectors, matrices, quaternions, tables, interpolation, Runge-Kutta, state-space, and optimization.
src/math - Geodesy · Geographic and Earth-model helpers used by propagation and location calculations.
src/GeographicLib - XML utils · Embedded XML and utility support used by model loading and configuration processing.
src/simgear/xml
Connections 29
- 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.