Professional Documents
Culture Documents
Aircraft Simulator
By: brentjustice 12-20-2014 09:43 PM Last Edited By: Paul-D 06-27-2017 09:39 AM Document options
Overview
A real-time controllable simulator was created for the purpose of test-flying the aircraft and for testing various
feedback control inputs. The following figure illustrates the graphical user interface (GUI) for the simulator.
Airspeed indicator
Control surface input display
Control inputs
Elevator
Aileron
Rudder
Throttle
Joystick Control
The simulation can be controlled in real-time through the use of a joystick. While it's possible that any generic
joystick might work with this code, I am only able to guarantee compatibility with the Logitech Extreme 3D Pro
joystick. The following figure illustrates the mapping of joystick axes to aircraft control surface input.
Where:
Y = elevator control
X = aileron control
RZ = rudder control
Throttle = motor power
Theory of Operation
The following is a summary of the process for simulating the aircraft response in real-time:
1. FlatEarth v9.53 generates linearized state space for aircraft dynamics
2. MATLAB script exports state space to text config files
3. Labview 2015 reads config files on startup
4. Labview 2015 Control Design and Simulation Module utilized for performing state space calculations
5. Timing logic used to enforce real-time operation
The state space variables, inputs, and outputs are defined in Table 4.
It is desirable to be able to apply proportional feedback control gains to the aileron, rudder, and elevator for aircraft
testing. The figure below illustrates how the open-loop state space is wrapped by a proportional controller.
Figure 5: proportional feedback controller applied to state space [10]
With the addition of the proportional controller, the state space equation can then be written as: [10]
User-Guide
Installation
You will need to install the following elements before being able to run this code:
1. LabVIEW 2015 Development system
2. LabVIEW Control Design and Simulation Module
Please note that LabVIEW 2015 and the Control Design and Simulation Module can be downloaded/installed for free for a 7-day trial. You can
extend this to a 45 day trial by creating a free National Instruments account. You can extend this to a 6 month trial by verifying your status as a
student to National Instruments.
The newly created folder contains all of the text files (state space variables) required for the LabVIEW simulation. One
file that you may wish to modify is the SIM_Controls.INI file. This files looks like this:
These numbers affect the range of motion of the joystick in the simulator. More specifically, if the max rudder is set at
25 degrees, then full rotation of the joystick yaw-axis will yield 25 degrees rudder deflection in the simulation. If you find
that you want a more/less sensitive joystick, you can increase/decrease this number as you please. Simply edit the file
and save. LabVIEW loads this file at run-time.
The max_speed input in slightly different. This simply affects the maximum number shown on the speedometer on the
GUI.
motor (BHP) from trip = throttle input from trim during step
motor (BHP) from trip = throttle input from trim during step
elevator ramp rate= degrees/s of elevator from trim during the ramp
motor ramp rate = BHP/s of throttle input from trim during the ramp
The filename is simply a timestamp of when the file was created at the end of the simulation. These files can be loaded directly into the MATLAB
workspace using the "load" command. (These are simply Level-5 .mat variable files.)
GUI Interface Description
The following images describe the GUI interface and the meaning/usefulness of various elements.
Simulation Validation
Simulation Validation - Longitudinal Direction
The longitudinal model was tested by injecting a doublet input on the elevator. More specifically, the elevator was
deflected -1 degrees from trim for 1 second, then deflected +1 degrees from trim for 1 second, and then brought
back to trim. The following figures show the FlatEarth output and Labview simulation output.
We see that the nonlinear FlatEarth, linear FlatEarth and Labview simulation results are all in acceptable
agreement for pitch rate response to elevator commands. As such, the following can be concluded:
We also see that with an elevator deflection, the pitch rate dampens out and approaches a steady state value of
zero. This corresponds to a dynamically stable aircraft in the longitudinal direction. This observation is in
agreement with the flight qualities analysis.
Figure 9: Labview simulation – roll and yaw angle response to doublet aileron input
We see that the nonlinear FlatEarth, linear FlatEarth and Labview simulation results are all in acceptable
agreement for yaw angle and roll angle for approximately 7 seconds. After this time, the linearized solution begins
to diverge from the nonlinear solution. This is to be expected as the linearized solution is only valid near trim
conditions. At t=7 seconds, the aircraft is in a deep spiral dive - far from steady-level flight. We can conclude the
following from these results:
Linearized model acceptable for near-trim flight
Labview simulation model acceptably operating at real-time
We also see from these figures that the aircraft is unstable in the lateral direction. As the aircraft rolls and yaws in
one direction, the angle grows over time. This is in agreement with the flight quality analysis which found the
aircraft to be unstable in the spiral mode.
Tutorial Video
Acknowledgements
1) Aircraft indicators taken from project here
2) Aircraft gimbal taken from project here
3) FlatEarth written by Professor Andriasani
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
8 KUDOS
COMMENTS
PrimaryKey NI EMPLOYEE (RETIRED) on Options
10-15-2015 06:05 AM
Great work! This is what the developers forum should showcase! Kudos
0 KUDOS
CONTRIBUTORS
Engineer
Ambitiously.™
解决方案
半导体 / 交通运输 / 航空航天、国防和政府 / 院校与科研 / 电子 / 能源 / 工业机械 / 重型设备 / 合
作伙伴
订单
查找分销商 / 订单状态和历史记录 / 报价查询 / 服务条款 / 按产品编号订购或请求报价
公司
领导团队 / 招贤纳士 / 投资者关系 / 新闻中心 / 企业影响 / 供应链/质量 / 活动
技术支持
下载 / 产品文档 / 论坛 / 激活产品 / 提交服务申请 / 网站反馈
© 2023 NATIONAL INSTRUMENTS CORP. 恩艾 (中国) 仪器有限公司 版权所有. 沪ICP备09002359号. 沪公网安备
31011502018878号
021-50509800(大陆)或 852-26453186(香港)