Code Monkey home page Code Monkey logo

mcflight's Introduction

McFlight

McFlight stands for Mechanics of Flight and so far is only a translation of the F-16 model found at Stevens and Lewis book, where the code is in Fortran. I reproduced it using two approaches: (1) in Scilab scripts and (2) by model-based design using xcos. Each folder tree structure is explained below.

(Learn more at http://e-feather.blogspot.com/)

Scripts

  • atmosphere: implementation of International Standard Atmosphere (ISA) model;
  • eqm: not only the equations of motion but also the engine and aerodynamic data for the F16;
  • sim: scripts of simulation and linearization examples;
  • tests: scripts for testing some scripts of the other folders. In case of the atmospheric model, for example, this is only a check of expected values from the literature; for the aerodynamic/engine models, the interpolation is checked as well;
  • trim: scripts for finding trim conditions, i.e., steady flight conditions.

Notice that the scripts shall be executed from the root folder mcflight/scripts.

This is a very first version of the toolset for control design and there are many points of potential improvement. Although for a quick check to see if all things are running I'd recommend:

  • Run the tests. Setting the current directory to root folder of mcflight/scripts, execute:
--> exec('tests\aerodata_interpolation_f16.tst');
--> exec('tests\atmosphere.tst');
--> exec('tests\engine_f16.tst');
--> exec('tests\eqm_f16.tst');
--> exec('tests\trim_f16.tst');
  • Run a script example which plots a comparison between linear and non-linear simulations of F-16 model:
--> exec('sim/plots_lin_nlin_f16.sce');

Xcos

This is the F16 model implemented using the model-based design approach.

In order to run the simulation with the full model of coordinated turn:

  1. Set the workspace directory to the xcos root folder (mcflight/xcos)
  2. Run the script 'tests/coordinated_turn_example.tst' (this may open the xcos window with the main model).
--> exec('tests/coordinated_turn_example.tst');
  1. Hit the simulation play (this may take some seconds) and check the 3d plot with the aircraft trajectory.

coordinated turn simulation

It is also possible to simulate a straight level flight ('tests/aircraft_model.tst').

You can run tests for each superblock seperatedly:

  • Setting the current directory to root folder mcflight/xcos, execute:
--> exec('tests\aerodynamics_model.tst');
--> exec('tests\atmosphere_model.tst');
--> exec('tests\engine_model.tst');

full aircraft model

TODO

  • Use model references model in Xcos (there are many redundant superblock implementations).
  • Try different aircraft models on the same structure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.