Jsbsim Tutorial -
Alex launches FlightGear: fgfs --fdm=jsbsim --aircraft=x1 . The X‑1 appears on the runway, virtual sun glinting. He takes off, and for the first time, the simulation looks and feels alive .
JSBSim outputs time‑step data to x1_taxi.csv . Alex plots yaw vs time. Works perfectly – the aircraft turns, gear compresses, no oscillation.
import jsbsim fdm = jsbsim.FGFDMExec() fdm.load_model('x1') fdm['propulsion/engine[0]/running'] = 1 fdm['fcs/throttle-cmd-norm'] = 1.0 for t in range(1000): fdm.Run() if t == 200: fdm['fcs/elevator-cmd-norm'] = -0.3 # pitch up print(fdm['position/h-sl-ft'], fdm['attitude/theta-deg']) jsbsim tutorial
<aerodynamics> <axis name="LIFT"> <coefficient name="CL"> <function> <table> <independentVar lookup="row">aero/alpha-rad</independentVar> <independentVar lookup="column">fcs/camber-command</independentVar> <!-- data from wind tunnel: rows alpha (-0.2 to 0.4 rad), cols camber (0 to 0.05) --> <tableData> -0.2 -0.4 -0.35 ... 0.0 0.2 0.25 ... 0.4 1.2 1.3 ... </tableData> </table> </function> </coefficient> </axis> </aerodynamics> He does the same for drag and pitch moment. For sideforce, yaw, roll, he uses simpler stability derivatives.
The X‑1 lifts off at 45 knots, climbs, then slowly rolls left due to an asymmetric thrust he forgot to model. Alex corrects by adding a trim tab definition under <flight_control><channel name="roll"> . Alex launches FlightGear: fgfs --fdm=jsbsim --aircraft=x1
<propulsion> <engine file="Rotax912"> <location> 0 0 0 </location> </engine> <propeller file="fixed_pitch"> <ixx> 0.2 </ixx> <diameter> 1.6 </diameter> <num_blades> 2 </num_blades> </propeller> </propulsion> He writes a taxi script: throttle 0.3, release brakes, wait 10 seconds, full rudder right.
JSBSim uses <function> and <table> to model coefficients. Alex writes: JSBSim outputs time‑step data to x1_taxi
<metrics unit="KG" unit_area="M2" unit_length="M"> <wingarea> 12.0 </wingarea> <wingspan> 10.0 </wingspan> <chord> 1.2 </chord> </metrics> All units are SI internally, but you can specify units per value. JSBSim converts. Part 3: The Aerodynamics Puzzle – Coefficient Tables Now the hardest part: the X‑1 has a variable‑camber wing (no flaps, but morphing trailing edge). No existing table works.