Introduction of Flight Simulation Based on NI Veristand, Simulink® and Flightgear

Updated Dec 22, 2023

Environment

Software

  • VeriStand
  • MATLAB

Operating System

  • LabVIEW Real-Time (NI Linux Real-Time)
  • Windows

Other

  • FlightGear

This article will introduce flight simulation system and walk through how to build flight simulation system based on NI VeriStand,  MathWorks®, Inc. Simulink® and FlightGear. The system involve technical knowledge about aircraft and  modelling, which is not discussed in detail.

Civil aircraft has large structure, high manufacturing precision, high technical difficulty, and complex development process. It is a large-scale complicated system engineering. The production of civil aircraft integrates a number of basic disciplines and emerging technologies. And it has the characteristics of multiple varieties, small batches, long cycle time, and customization. With the development of science and technology, civil aircraft has higher and higher requirements for various performance indicators such as controllability and safety. While ensuring performance indicators, reducing the design and development cycle has become an insurmountable technical problem in the development of civil aircraft. In order to solve this technical bottleneck, digitization, networking, and intelligence have become important approaches for the transformation and upgrading of civil aircraft development. Flight simulation systems, as powerful design tools, are widely used in various stages of aircraft development and have become indispensable technical means.

The role of flight simulation system depends on the specific simulation equipment. It can perform full digital flight simulation. By correctly predicting the behavior of systems, subsystems and components, it helps to find problems early and make the design better.  In order to greatly shorten the development cycle of aircraft-related tasks and reduce the risks of flight test, it is also possible to add real components or subsystems to perform hardware-in-the-loop flight simulation of the entire aircraft. It can effectively define, confirm and verify the requirements of systems, subsystems and components. It is even possible to add a visual simulation and evaluation system to support the reproduction of possible failures in air on the ground. It can be used to analyze and solve the possible failures in air, so that the pilots can receive system training on the ground.

Setting Up the Software Environment Build Flight Simulation Models
  • Flight simulation system consists of aircraft model, flight controller, power model, landing gear model, actuator model and environment model. 
  • Define interfaces for every model and build these simulation models with MathWorks®, Inc. Simulink®. The following are attitude controller, aircraft model and aerodynamic model. Every model needs professional technical knowledge about modelling and aircraft. Aerospace Blockset can be helpful or you can build all the models totally by yourself if you are familiar with modelling and aircraft.
Flight Simulation in NI VeriStand
  • Import the DLL models or FMI Models into NI VeriStand, refer to Adding and Configuring a Model.
  • Config interactions between different models based on flight simulation system structure in Configure Mappings.
Visualization Display in FlightGear
C:
cd C:\Program Files\FlightGear 2018.3.6
SET FG_ROOT=C:\Program Files\FlightGear 2018.3.6\data
.\\bin\fgfs --aircraft=A320-211 --fdm=network,localhost,5502,udp --fog-disable --disable-clouds --time-match-local --disable-sound --in-air --enable-freeze --airport=KSFO --runway=10L --altitude=7224 --heading=113 --offset-distance=4.72 --offset-azimuth=0
  • Run the launching file and change viewing angle by pressing <v> or dragging the right mouse.
  • Download FlightGear Interface Custom Device and  uncompress the source files.
  • Open the source file with LabVIEW and change the Destination Directory for  configuration file and engine file based on NI VeriStand version and installation.
  • Right click on Build specification and select Build All.
  • Map the inputs to the custom device with the outputs of your model: -Airspeed -Altitude -Latitude -Longitude -Phi -Psi -Theta
  • Deploy and run the flight simulation project in NI VeriStand.

There is an example for three degree of freedom attitude simulation for A320。This example is built on the scenario that the airplane is flying at constant speed and altitude.
 

Deploy and run this project. The statuses and results can be observed in NI VeriStand and the animation of airplane can be displayed in FlightGear.