Jsbsim Tutorial [verified] [ HD — 480p ]
<!-- 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>
Now, open a terminal and navigate to the JSBSim executable location. jsbsim tutorial
<!-- Execute the simulation --> <event name="Start_Climb" time="10.0"> <set name="fcs/elevator-cmd-norm" value="0.1"/> </event> You just flew a virtual aircraft that calculates
JSBSim --aircraft=c172_tutorial The interactive shell will appear. Type: Basic Python Script import jsbsim import matplotlib
> start > set fcs/elevator-cmd-norm 0.1 > run 1000 > get position/h-sl-ft Congratulations. You just flew a virtual aircraft that calculates its own physics. For 90% of modern users, Python is the gateway. The jsbsim module gives you full control. Basic Python Script import jsbsim import matplotlib.pyplot as plt import numpy as np Create the FDM executive fdm = jsbsim.FGFDMExec() Load the aircraft (assumes aircraft is in $JSBSIM_ROOT/aircraft) fdm.set_aircraft_path('./aircraft') # Path to your models fdm.load_model('c172_tutorial') fdm.set_dt(0.01) # 100 Hz simulation Initialize to a trimmed state fdm['ic/h-agl-ft'] = 1000 # Initial altitude 1000 ft fdm['ic/vc-kts'] = 100 # Initial speed 100 knots fdm['ic/gamma-deg'] = 0 # Flight path angle fdm.init() # This runs the trim routine Data logging arrays time = [] altitude = [] airspeed = [] Run for 60 seconds for i in range(6000): # 6000 * 0.01 = 60 seconds fdm.run() t = fdm.get_property('sim-time-sec') alt = fdm.get_property('position/h-sl-ft') vc = fdm.get_property('velocities/vc-kts')
JSBSim --version Or, in Python:
The sky is not the limit—it’s the initial condition. Happy simulation.