Documentation

Simulink Projects Template for Flight Simulation Applications

Flight Simulation Applications

Use Simulink® Projects (Simulink) to help organize large flight simulation modeling projects and makes it easier to share projects with others.

The Aerospace Blockset™ software supplies a Simulink projects template that you can use to create your own flight simulation application. This template uses variant subsystems, model variants, and referenced models to implement flight simulation application components such as:

  • An airframe that contains a 6DOF equation of motion environment model and actuator dynamics

  • An inertial measurement unit (IMU) sensor model

  • A visualization subsystem oriented for FlightGear

  • A model of the nonlinear dynamics of the airframe

  • A model of the linear dynamics of the airframe

Download the Flight Simulation Template

  1. From Simulink, select New > Simulink Project > Flight Simulation Example.

  2. In Simulink Project, in Project name, enter a project name, for example FlightSimProj.

  3. In Project folder, enter a project folder or browse to the folder to contain the project, for example FlightSimFolder.

  4. Click Create.

    If the folder does not exist, the dialog prompts you to create it. Click Yes.

    The software compiles the project, populates the project folders, and opens the main model, flightSimulation. All models and supporting files are in place for you to customize for your flight simulation application.

The flight simulation project template contains the following folders

  • controller

    Contains the models for the Flight Control System (FCS) and its design. These models contain referenced models for different controller architectures needed for the design of aircraft simulation.

  • libraries

    Contains the libraries used by the models.

  • linearAirframe

    Contains the linear dynamics of the airframe.

  • mainModels

    Contains the top-level simulation model, flightSimulation.

  • nonlinearAirframe

    Contains a model of the nonlinear dynamics of the airframe.

  • src

    Contains C code. For simulation, it also has two folders that contain S-functions for simulation.

  • tasks

    Contains scripts to run the model. These scripts do not run continuously during the simulation process.

  • tests

    Contains a sample test harness, including a test file, linearTest, and a script, runProjectTests, that runs the designated tests in the project.

  • utilities

    Contains project-specific maintenance task utilities.

  • work

    Contains files generated from every run. These files derive from source files, such as the MEX-file that you build from S-function C code.

In Shortcuts, Simulink projects creates shortcuts for common tasks such as:

  • Set up and clean up projects.

  • Add projects to MATLAB® paths.

  • Initialize variables.

  • Rebuild S-functions.

  • Run project tests.

  • Start the top model.

Add Airframe Dynamics and Controller Algorithm to the Project

  1. To open the linearAirframe model, in flightSimulation double-click the Airframe subsystem.

  2. Double-click the Nonlinear subsystem.

  3. In the AC model, add your airframe dynamics.

  4. Save the model.

Add Controller Algorithm to the Project

  1. To open the flightControlSystem model, in flightSimulation, double-click the FCS subsystem.

  2. In the Controller subsystem, add your controller algorithm.

  3. Save the model.

Other things to try:

  • Simulate your model.

  • Explore the tests folder for sample tests for your application.

Related Topics

Was this topic helpful?