Sei sulla pagina 1di 3

Using FlightGear with Simulink

Daniel Wiese Department of Mechanical Engineering Massachusetts Institute of Technology June 11, 2012

Introduction
The open source ight simulator FlightGear can be integrated with Simulink to play back recorded simulation data in the graphical display window to show the aircraft motion during ight. More information on FlightGear can be found at http://www.flightgear.org/ and http://wiki.flightgear.org/Main_Page. The Simulink block in the Aerospace Blockset which takes this output data and sends it to FlightGear is explained here: http://www.mathworks.com/ help/toolbox/aeroblks/packnet_fdmpacketforflightgear.html. This page includes descriptions of all the possible input variables, data types, units, and supported FlightGear versions. This document will only serve as a brief tutorial covering the basics of integrating FlightGear with Simulink.

Getting Started
FlightGear version 2.4.0 was used in making this tutorial, although it is not specically supported by Simulink. The following three blocks are needed, and can be found in the Aerospace Blockset directory of the Simulink library browser. Under the Aerospace Blockset/Animation/Flight Simulator Interfaces/ directory: Pack net fdm Packet for FlightGear Send net fdm Packet to FlightGear Under the Aerospace Blockset/Animation/Animation Support Utilities/ directory: Simulation Pace These blocks should be placed in a Simulink model le as shown in Figure (1) below. By default, the block Pack net fdm Packet for FlightGear will have inputs for latitude, longitude, altitude, and Euler angles. Other inputs can be added by right clicking on the block, clicking additional inputs under Mask Parameters, and selecting additional variables. When using a at earth, xyz coordinates will have to be converted to latitude and longitude which will be used to plot the position. Some of the inputs to the Pack net fdm Packet for FlightGear block may have to be formatted so the data type matches the required type using the Data Type Conversion block in the Simulink/Signal Attributes/ directory.

l h packet Pack net_fdm Packet for FlightGear


Version Selected: v2.0

Send net_fdm packet to FlightGear Send net_fdm Packet to FlightGear

Set Pace Simulation Pace


1 sec/sec

Figure 1: Simulink blocks

The simulation data can be inputted into this block from the workspace. Before the model le can be run, FlightGear needs to be opened and initialized. To do this, the following batch le is used. This allows the aircraft model, starting position, weather conditions, and more to be set. Make sure to replace the directories with the corresponding installation directory on your computer. The command line parameters are listed here: http://www.flightgear.org/Docs/ getstart/getstartch3.html.
1 2 3 4

cd C:\Program Files (x86) \ FlightGear 2.4.0 SET FG ROOT=C:\Program Files (x86) \ FlightGear 2.4.0 \\ data cd bin \ Win32 \ fgfs aircraft=777200ER fdm=network,localhost,5501,5502,5503 fogfastest ... disableclouds startdatelat=2004:06:01:09:00:00 disablesound ... inair enablefreeze airport=KSFO runway=10L altitude=7224 ... heading=113 offsetdistance=4.72 offsetazimuth=0

Running FlightGear
With the block diagram and batch le completed as shown in Figure (2) and saved, the simulation is ready to run. Run the batch le, and FlightGear will open with the options specied. Generate the aircraft conguration data and save it to the workspace. Once the Simulink model is run, the aircraft displayed in the FlightGear window will y, showing a visual representation of the conguration data.

l h output_data single single single Pack net_fdm Packet for FlightGear


Version Selected: v2.0

packet

Send net_fdm packet to FlightGear Send net_fdm Packet to FlightGear

Set Pace Simulation Pace


1 sec/sec

Figure 2: Simulink blocks

Figure 3: Flightgear screenshot of Boeing 747

Potrebbero piacerti anche