Jsbsim Tutorial May 2026
The root of your aircraft is an XML file. Open my_plane.xml in a text editor. It contains five critical sections:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="http://jsbsim.sf.net/JSBSim.xsl"?> <fdm_config name="Cessna 172P Tutorial" version="2.0" release="experimental"><metrics> <wingarea unit="FT2"> 174.0 </wingarea> <wingspan unit="FT"> 35.8 </wingspan> <chord unit="FT"> 4.9 </chord> </metrics>
<mass_balance> <emptywt unit="LBS"> 1663.0 </emptywt> <location name="CG" unit="IN"> <x> 2.5 </x> <!-- Forward of the aerodynamic center --> <y> 0.0 </y> <z> 0.0 </z> </location> <ixx unit="SLUGFT2"> 948 </ixx> <iyy unit="SLUGFT2"> 1346 </iyy> <izz unit="SLUG*FT2"> 1967 </izz> </mass_balance>
Launch the shell:
JSBSim --interactive --aircraft=c172_tutorial
Inside the shell:
> set loglevel 3
> run 100
> get aero/qbar-psf
> get forces/fbz-lbs
> property-list aero/
The property-list command is a lifesaver. It shows every available property under that branch.
JSBSim’s native scripting language is powerful for automation. Create a file called climb_test.xml in the scripts/ folder.
<?xml version="1.0"?> <runscript> <use aircraft="c172_tutorial" initialize="reset"/><run start="0.0" end="100.0" dt="0.01">
<!-- Set initial conditions --> <property value="1000">ic/h-agl-ft</property> <property value="100">ic/vc-kts</property> <!-- Execute the simulation --> <event name="Start_Climb" time="10.0"> <set name="fcs/elevator-cmd-norm" value="0.1"/> </event> <event name="Level_Off" time="50.0"> <set name="fcs/elevator-cmd-norm" value="0.0"/> </event> <!-- Output to CSV for analysis --> <output type="CSV" filename="climb_test_output.csv"> <property>sim-time-sec</property> <property>position/h-sl-ft</property> <property>attitude/phi-rad</property> <property>attitude/theta-rad</property> <property>velocities/vc-kts</property> </output>
</run> </runscript>
Run this script with:
JSBSim --script=climb_test.xml
Open climb_test_output.csv in Excel or a text editor. You now have a validated flight test dataset generated purely from your XML model.
Information about the plane: name, author, type.
JSBSim exposes a property tree via Socket or HTTP. Enable the socket server in your script:
<output type="SOCKET" port="5123" protocol="TEXT" rate="30">
<property>position/lat-deg</property>
<property>position/lon-deg</property>
</output>
Then write a simple Python script to read from localhost:5123 and update a 3D model. jsbsim tutorial
JSBSim has a built-in PID controller system. Let's add a simple altitude hold to your XML.
Inside the <systems> section of your aircraft file, add:
<system name="autopilot">
<pid name="altitude_hold">
<input>position/h-sl-ft</input>
<reference>5000</reference> <!-- Hold 5000 feet -->
<kp>0.001</kp>
<ki>0.0001</ki>
<kd>0.01</kd>
<output>fcs/elevator-cmd-norm</output>
<clipto>
<min>-1.0</min>
<max>1.0</max>
</clipto>
</pid>
</system>
Now, when you run the simulation, the aircraft will automatically pitch to maintain 5,000 feet. This is the same logic used in real autopilots.
JSBSim is an open-source flight dynamics model (FDM) used for aircraft simulation and flight control development. This brief tutorial shows how to install JSBSim, run a basic simulation, inspect outputs, and create a simple script to trim and trim-run an aircraft.

