Matlab Flight Simulation

0 views
Skip to first unread message

Joseph

unread,
Aug 4, 2024, 3:11:17 PM8/4/24
to daithonelra
Theflight dynamics model (FDM) specification is a requiredelement for an aircraft model. To set the Simulink software asthe source of the flight dynamics model data stream for a given geometrymodel, you put this line in data/Aircraft/model/model-set.xml:

When creating your own geometry files, keep in mind that yourgraphics card can efficiently render a limited number of surfaces.Some cards can efficiently render fewer than 1000 surfaces with bitmapsand specular reflections at the nominal rate of 30 frames per second.Other cards can easily render on the order of 10,000 surfaces.


If your performance slows while using a particular geometry,gauge the effect of geometric complexity on graphics performance byvarying the number of aircraft model surfaces. An easy way to checkthis is to replace the full aircraft geometry file with a simple shape,such as a single triangle, then test FlightGear with this simplergeometry. If a geometry file is too complex for smooth display, usea 3-D geometry editor to simplify your model by reducing the numberof surfaces in the geometry.


This example illustrates how to prepare hinge line definitionsfor animated elements such as vehicle control surfaces and landinggear. To enable animation, each element must be a named entity ina geometry file. The resulting code forms part of the HL20 liftingbody model presented in Run the HL-20 Example with FlightGear.


To run a Simulink model of your aircraft and simultaneouslyanimate it in FlightGear with an aircraft data file model-set.xml,you need to configure the aircraft data file and modify your Simulink modelwith some new blocks.


To start FlightGear with the desired initial conditions (location,date, time, weather, operating modes), it is best to create a runscript by Use the Generate Run Script Block or Use the Interface Provided with FlightGear.


If you make separate run scripts for each model you intend tolink to FlightGear and place them in separate directories, run theappropriate script from the MATLAB interface just before startingyour Simulink model.


Use the Interface Provided with FlightGear. The FlightGear launcher GUI (part of FlightGear, not the Aerospace Blockset product)lets you build simple and advanced options into a visible FlightGearrun command.


If your computer has enough computational power to run both the Simulink software and FlightGear at the same time, a simple way to startFlightGear on a Windows system is to create a MATLAB desktop button containing this command to execute a run scriptlike the one created above:


Free up processor power by running the Simulink modelon one computer and FlightGear on another computer. Use the Destination IP Address parameter of the Send net_fdm Packet to FlightGear blockto specify the network address of the computer where FlightGear isrunning.


Simulate the Simulink model first, then savethe resulting translations (x-axis, y-axis, z-axis)and positions (latitude, longitude, altitude), and use the FlightGearAnimation object in Aerospace Toolbox to visualize this data.


It is possible to simulate an aerospace system in the Simulink environmenton one computer (the source) and use its simulation output to animateFlightGear on another computer (the target). The steps are similarto those already explained, with certain modifications.


If you want to also receive data from FlightGear,use the Receive net_ctrl Packet from FlightGear block.Enter the IP address of the computer running FlightGear in the OriginIP address parameter.


The Aerospace Blockset software contains an example model of the HL-20 lifting body that usesthe FlightGear interface and projects. This example illustrates many features of theAerospace Blockset software. It also contains a Variant Subsystem block that you can useto specify the data source for the simulation. You might want to use the VariantSubsystem block to change the terrain data source or if you do not want to useFlightGear but still want to simulate the model.


Step 2 of this example copies the preconfigured geometries for the HL-20simulation fromprojectroot\support toFlightGear\data\Aircraft\. Itrequires that you have system administrator privileges for your machine. If youdo not have these privileges, manually copy these files, depending on yourplatform.


The Pack net_fdm Packetfor FlightGear block formats a binary structure compatiblewith FlightGear from model inputs. In the default configuration, theblock displays only the 6DoF ports, but you can configure the fullFlightGear interface supporting more than 50 distinct signals fromthe block dialog box:


The Send net_fdm Packetto FlightGear block transmits this packet via UDP to the specifiedIP address and port where a FlightGear session awaits an incomingdatastream. Use the IP address you found in Obtain the Destination IP Address.


The Simulation Pace blockslows the simulation so that its aggregate run rate is 1 second ofsimulation time per second of clock time. You can also use it to specifyother ratios of simulation time to clock time.


FlightGear Preconfigured 6DoFAnimation Generate Run Script Pack net_fdm Packet for FlightGear Receive net_ctrl Packet fromFlightGear Send net_fdm Packet to FlightGear Unpack net_ctrl Packet fromFlightGear


In this webinar, you will learn how you can apply Model-Based Design with MATLAB and Simulink for air vehicle design and automatic flight control. Engineers working in the aerospace field can use MATLAB and Simulink to improve the design workflow for:


The primary focus is for engineers whose workflow involves modeling, simulation, and control of aircraft. Many of the Model-Based Design and control concepts shown in this webinar can be applied to a variety of applications.


Hello and welcome to the Modeling Simulation and Flight Control Design of an Aircraft with Simulink. My name is Ryan Gordon. I'm a product manager here at the MathWorks for the Aerospace Toolbox and Aerospace Blockset. To show you what we'll be doing today, I'm going to jump right over to Simulink and show you the model that we'll be designing.


Let me start by running the model, and here you'll see our full dynamic model along with control system for the aircraft seen visualized here on the left with the FlightGear. If I come into the pilot block, I have three main commands that I can send to the autopilot system that I'll actually be utilizing today. First, I have an altitude command, and when I'm in altitude hold mode I can send a command to the altitude, the aircraft will pitch to achieve the altitude and hold the altitude. I have a speed command to vary the speed using an auto throttle, and I have this auto climb engage command that will let me change between the altitude hold mode and a climbing mode where I go to max power and the aircraft will pitch to achieve the speed.


And when I activate that, you'll see the aircraft is now at max power and it's pitching up to achieve that 85 meters per second speed. And if I slow it down, you'll see it pitches up even more, because to achieve a 75 meters per second speed it needs a higher pitch angle. And if I disengage the auto climb, it will pitch back down to achieve that 2100 meter altitude command. And so today, I'm going to show you how you can design a dynamic system in Simulink for this aircraft. I'm going to show you how you can design this autopilot system for this aircraft and how you can visualize it in FlightGear using the Aerospace Blockset.


So how does this all work with MATLAB and Simulink? Well first, let's talk about the iterative design process for designing aircraft flight control. First, you need to design the dynamic model. So how do you do that? You'll start by determining the geometry of your vehicle, determining the aerodynamic characteristics of the vehicle based on that geometry-- this can be done through a number of different methods including wind tunnel testing. You'll create a simulation to verify that design, and once you have a simulation, you can design the flight control laws based on that model.


As an aircraft flight control designer, you may have to iterate through this process several times before you achieve your desired results, and while you're iterating through this design there are additional steps that you may also be working on such as creating a hardware in the loop simulation, building hardware and software such as the actual vehicle to do flight testing and then analyzing and visualizing those results from the flight test. Today, we'll focus on the top four highlighted blocks, but there are tools available to help you throughout this entire design process.


And this is how those first four steps map over to the webinar that I'm showing today. First, I'm going to model the aircraft dynamic system. I'll model the aerodynamics from DATCOM. DATCOM Is software designed by the US Air Force that allows you to input aircraft geometry, and it will tell you what the aerodynamic characteristics and coefficients of that geometry are based on the inputs. I won't cover how the DATCOM system actually works, but I will cover how you can use the results of DATCOM in MATLAB and Simulink.


I'll build up a three degree of freedom longitudinal dynamic model. I'll design the environment for my dynamic model for wind, gust, turbulence, and gravity. I'll design a flight control for two modes of flight-- the altitude tracking mode, and that maximum thrust climb mode that will allow me to make big step changes in climb by going to maximum power and controlling speed with pitch. I'll do that by using automatic PID tuners, and then I'll be able to visualize the transition between those two different modes of flight using state flow. And throughout this entire process, I can visualize the results in three dimensions using the Simulink to FlightGear interface as part of the Aerospace Blockset.


So let's start with that first step, modeling the aircraft dynamic system. For this step, I'll primarily be using, on top of MATLAB and Simulink, the Aerospace Toolbox and the Aerospace Blockset. These tools are going to allow me to rapidly design, simulate, and visualize my entire modeling design process. So this is where the Simulink to FlightGear lives, where the three DOF block lives that will allow me to just simply drag and drop a single block in to have a full three degree of freedom dynamics in Simulink. One of the first features I'll be showing is the DATCOM import and Simulink DATCOM interface. And this is where all of my environment models also live for my atmosphere, wind, and turbulence. So let's go back over to MATLAB and Simulink so I can show you what these are all about.

3a8082e126
Reply all
Reply to author
Forward
0 new messages