About the Math Model - Aerodynamics - Presented To: NASA Ames ESTOL Sector / Cal Poly Team By: Cassy Anthony and Natalia Sanchez September 2006 San Luis Obispo, CA MATH MODEL SCOPE (1.3 from Manual) This document serves as an introduction to the QSRA Math Model that is currently being replicated and adapted to the Cal Poly SimLab for comparison to the NASA simulation. This overview is intended to provide an understanding of the concept and type of model used in a real-time flight simulation. Preface A simulation system consists of a mathematical model, simulator hardware (computers, cab, instrumentation), visual system (X-plane interface), and motion system (not yet functional at the Cal Poly Lab). The math model is a key part of the total simulation system, which ideally mirrors the behavior of the real aircraft in the areas under consideration. The math model is the description and specification of the aircraft’s dynamic behavior. This comprises the various motions of the airframe and the states and performance of the various subsystems (engine, landing gear, and avionics). The math model considers all the external and internal influences on the aircraft and defines the resultant states of the aircraft and its subsystems (Thomas S. Alderete, NASA Ames Research Center, Moffett Field, CA). The model is best presented by equations, diagrams, logic charts, tables, and graphs of data including geometry, aerodynamic parameters, gain schedules, etc. These equations, diagrams, and data comprise the actual math model, and can be found in the hard copy of the Quiet ShortHaul Research Aircraft Phase II Flight Simulation Mathematical Model Final Report (Boeing Co. and NASA 1979). Two copies of this “manual” are available in the Aircraft Design Lab at Cal Poly. The digital computer program and its associated data is an implementation of the math model. This is the current focus of this task, and for this reason all the graphs in the QSRA manual are being digitized and the Simulink models replicated. The majority of the graphs correspond to the Aerodynamic area of the model, and the Simulink models correspond to the Controls and Propulsion sections. These are the three aspects of the model that will be elaborated throughout this summer. For the final implementation of the model, all the data needs to be put into code that would be compatible with the SimLab program. There are several other documents that found in the Cal Poly Aircraft Design lab that are useful in modeling the QSRA. Probably the most important of these is the QSRA Operations manual, by Boeing. A listing of other Boeing/QSRA materials is available on the Swat server, under the name “File Inventory (most recent date).xls”. Model Breakdown The math model uses a modular construction technique. The following modules are described in the Final Report of the QSRA Phase II Flight Simulation Mathematical Model (1979): 1. Airplane Configuration 2. Propulsion System 3. Aerodynamic Forces and Moments 4. Flight Control Systems 5. Atmosphere Model The highlights and limitations of each module of the QSRA simulation math model are presented in Table 1.1 of the manual (pg. 73). Note that there is a wealth of data available in the Figures and tables at the second portion of the math model, the tables alone do not describe a complete aircraft model. The textual/equation based description must be consulted, and figures/tables are substituted for equations, when specified by a reference in the textual model description. 1. Airplane Configuration ( 3.0 Airplane Description pg. 9-10, 87-90) QSRA Geometry QSRA weight range, inertias, CG Landing gear (8.0 Sect. 57-60, 351) 2. Propulsion System (Sect. 4.0 pg. 11-15, 91-115) Separate math model for each YF-102 engine BLC system for L.E. and aileron BLC Mach (0 - 0.3), altitude and temperature effects Transient thrust dynamics and engine failure Cockpit throttle travel and engine instrument displays Inlet mass flow “ram” forces and moments 3. Aerodynamic Forces and Moments (Sect. 5.0 pg. 21-39, 116-284 Figures) All flap settings All control surfaces Leading edge and aileron BLC effects All gross thrust effects (thrust simulation for Cj>5) Horizontal tail aerodynamics (downwash, local flow fields, tail stall, etc) Model matches critical performance conditions 4. Flight Control Systems (Sect. 6.0 pg. 41-50, 285-341) Electrical and mechanical paths simulated Sensor model includes provisions for failure insertion Pitch control: mechanization and actuation properties, etc Flap control: control rates for USB flaps, lateral-directional control, spoilers and ailerons rigging simulated, feel forces trim Hydraulic powered actuators 5. Atmosphere Model (Sect. 9.0 pg. 61-66, 352-357) Standard atmosphere (hot/cold) Low altitude wind and turbulence model: wind shear, etc PERIPHERAL MATH MODELS (Sect 10.0 pg. 67-68, 358-360) Empennage Air Loads Maneuver Margin The Simulation Interface at Cal Poly The next section intends to serve as reference for the programming aspect of the simulation. It comes from the Pheagle Documentation written by the SimLab operators (Keith Rothman), and has been modified for the QSRA simulation. It includes a general overview of how the different modules described above are coded into the Cal Poly simulation interface. This simulation is based on the 1979 QSRA math model, which was designed to be compatible with the Ames Research Center’s FSAA (Flight Simulation for Advanced Aircraft) simulation facility. This facility includes standardized software packages written by the Computer Sciences Corporation, the McFadden feel force loader system, and FSAA data acquisition systems. The Cal Poly model, on the other hand, has been developed in Simulink and C++ with X-Plane graphics. All the software behind the simulation is based on programming done by Cal Poly undergrad and graduate students. The basic layout of the simulation interface can be illustrated as follows: Each airplane is contained inside of the Airplane block (which initiates from the qsra_2_0.mdl – Simulink model file). This provides a container for the whole system. The blocks under the Airplane block, also known as classes, are composed of S-functions from C++ source code. Each block pulls data from the library and the tables, which are input as text, h, and cpp files. The Airplane block in Figure 1 can be considered the Mask and the Goto Visibility blocks. Figure 1: Airplane Block Mask Figure 2 below shows the inside of the Airplane block as modified for the QSRA Aircraft. The blank template provided by an empty Airplane block for any airplane is illustrated in page 22 of the Pheagle Documentation, as a reference. That template is the basis for all the models at the Cal Poly SimLab. Support Blocks Display Signal Routing Forces and Integration Figure 2: Inside the Airplane Block The blocks in this figure perform different functions needed for flight simulation. This structure mirrors the modular layout described in the Model Breakdown section above, where all the modules complement one another to simulate the overall behavior of the aircraft. The flight simulation can be divided into four main parts: Forces and integration Support Display Multiplayer The “Forces and Integration” blocks calculate the current forces, adds them together, and the “SixDof” integrator takes that force and applies it to the simulated aircraft. Then using the current aircraft data the “Support” blocks provide things like air density, temperature, and tells the model when you have hit the ground, or broken apart. This data is passed back into the forces blocks, and the cycle begins again. The “Multiplayer” and “Display” blocks take the data from the integrator and communicate with other player models, or with the graphics engine (currently X-Plane). Adding an Aircraft into the Simulation In order for the simulation to work with any aircraft, at least one file is needed: the Aerodynamics Table file. This provides the majority of the data required for simulating the aircraft. Unfortunately, the sole addition of this table will not allow for landings, accurate engine data, correct graphical display, or proper ground registration by the crash detector. In order to have a “complete” simulation you should correct following: Table I. Main Settings File/Settings Aerodynamics Table File Gear file Required for? Simulation Importance Must include Landing and takeoff Crash file Crashing Engine Settings CAS system Graphics file Airport file Accuracy Proper Pilot Control X-Plane Model Airport locations Structure file Structure Airbrake settings Airbrake View file X-Plane Communication If you want to interact with the ground this is a must If you want to interact with the ground this is a must Greatly improve accuracy Depends on stability of aircraft Visuals only, no impact on simulation Only if the currently entered locations are insufficient If you need FAR requirement checking, this will help you If you do not have an aerodynamics table to cover this, adjust these settings Critical for X-Plane displaying, but no relevance to the simulation accuracy Aerodynamics Introduction Since Aerodynamics is a primary aspect of the simulation, and it constitutes about 70% of the mathematical model, special emphasis has been placed on the implementation of this module. As described in the QSRA Simulation report, the Aerodynamics math model includes the following: Six component forces and moments for the set of conditions specified below: o All flap settings o All control surfaces and flap surface deflection o Powered-lift blowing effects in all axes o Leading-edge and aileron BLC effects o Ground proximity effects The limitations of the model are also listed next. o Ve < 200 knots o Except for takeoff roll, data is limited to 8° 32°, CJ 5.0, and 25° o Post-stall effects not fully simulated o Fin maximum lift limits not simulated for large sideslip angles ≈ 25° o Dynamic derivatives due to P, Q, R, , are calculated from theory o Model produces match with critical performance points o Airplane takeoff performance cannot be based on YC-14 ground effect data Horizontal tail lift limits and downwash at tail included Math Model Description The data are built up around cruise, takeoff, go-around, and maximum descent flight conditions. All the data are functionally dependent of the gross thrust momentum coefficient (CJ), and a net BLC momentum coefficient (C ). Special provisions are made to extend the axes buildup down to zero q. Note: the dynamic pressure in this model is denoted by q_dp (control 32), otherwise the variable q indicates pitch rate. This provision allows simulation of the takeoff ground roll maneuver (Report page 22). The control surfaces and reference flap setting are defined in Figure 5.2-3 and 5.2-4 of the report, pages 119 and 120 respectively. The two graphs illustrating the reference flap settings were handled in Simulink instead of making them into text tables like the rest of the Aerodynamics graphs. The sign convention used for the zero math model is shown in Figure 5.2-2, page 118 in the report. The major elements of the aero math model (found in pages 22 and 23 of the QSRA report) can be broken down into 4 categories: Aerodynamic Forces and Moments (Body Axis) – XA, YA, ZA, etc. Stability Axis Forces and Moments – XS, YS, ZS, etc. Direct Thrust Forces (CJ > 5) – XDT, YDT, ZDT, etc. KDT ( Gain for low q_dp) Each category is represented by a set of equations that has been included in the Simulink file Thurst_Forces.mdl as an Embedded function. These sets of equations come together as illustrated in Figure 5.2-1b (pg. 117) to give the final equations of motion that govern the entire behavior of the aircraft. There are 2 kinds of input variables: Takeoff input variables and Independent Arguments. The take off variables apply to low q_dp values and use the Direct Thrust Forces XDT, YDT, ZDT, etc. The Independent Arguments come from the Aerodynamics graphs for CJ < 5, which are the aero parameters in the text tables. These are also the stability axis forces and moments denoted by XS, YS, ZS, etc that are fed into the embedded function as SDOFin. These are then converted into Body axis forces (multiplying by KDT) to yield XA’, YA’, ZA’, etc. The forces and moments from Direct Thrust and Body Axis are multiplied by their corresponding KDT and then added together to obtain the final Aerodynamic Forces and Moments in Body Axis XA, YA, ZA, etc (pages 22 and 23). The next section expands on the connections between the Aerodynamics equations, the graphs, and the code in the simulation. It pertains to the aerodynamic coefficients used in the computation of the in the Stability Axis aerodynamic forces and moments. Aerodynamics Equations in the Simulation Program As mentioned in the preface, the final report of the QSRA simulation contains graphs, block diagrams, schematics, and equations that complement each other to achieve the full implementation of the math model. All the graphs in the Aerodynamics section have been digitized and integrated into the SDOF model at the Cal Poly SimLab by means of a text table containing all the Aerodynamic parameters: QSRA_Full_Table_08_23_06.txt. Each of the graphs represents either an equation or a term in an equation from section 5 of the manual. For example: section 5.3 lists the equations for Lift (Aerodynamic parameter CL). The first equation is the general equation, which includes all the terms that affect lift such as Lift due to USB flaps, Lift due to Ground Effect, Lift due to Spoilers, etc. Each of those terms has one or several components that correspond to a graph (a table once it has been digitized). All the graphs are found in the Aerodynamics section of the report pages 121 to 284. Change in lift due to Ground Effect, for example, is the product of F_GE (Ground Effect Function) and ΔCL_G (Lift Increment due to Ground Effect). Data for F_GE and ΔCL_G is shown in graphs 5.3-4a and 5.3-4b, respectively. An organizational chart in Aero Eqs. Flochart.doc shows how all the components come together under each parameter. The compilation of terms for the equations in sections 5.3 to 5.8 is done by means of a data structure in C++ that groups variables and functions, and adds each component of the general equation to its corresponding parameter (CL, CD, Cm, etc). This code alone is found in Product Terms and functions.txt, in the QSRA_LIB folder, but it is actually added to the QSRA_Full_Table to obtain the final input for the aerodynamics (e.g. Sim Table) in the Airplane block. The functions called in this code are specified in the C++ file QSRA_LIB.cpp, which contains the code form of all 60 equations required to accurately replicate the Aerodynamic forces and moments acting on the aircraft. A list of these equations was put into a spreadsheet for quick reference; the name of the Excel file is Equations for Sim.xls. A third file is needed to tell C++ to make the functions available to the simulation program; this file is called QSRA_LIB.h, name of .dll file and what it does. There is one exception to the use of text tables in C++. Downwash free air is the only parameter that was a four dimensional set of graphs in the QSRA Phase 2 Math Model Report and since it is difficult to input a four dimensional table into C++, MATLAB and Simulink were used instead. The free air downwash was put into the model as a control because MATLAB was used. It is very easy to establish a four dimensional table in MATLAB then saving that as a .mat file and inputting that into Simulink to use it as a lookup table. Therefore, the only aerodynamics graph that is not included in the C++ table lookup is the downwash free air. Another feature to notice about the math model is that a negative CD accounts for Thrust as part of the Aerodynamic forces acting on the aircraft A more detailed, programming-oriented overview of this system is provided next. It is intended as a continuation of the Cal Poly Simulation Interface section, since it has been taken and modified from the original Pheagle documentation at the SimLab. The Aerodynamics Block (aerodyn_1_0.dll) The Aerodynamics block generates aerodynamics forces based on a table-lookup system. It takes data specifically from the Aerodynamics table mentioned in the previous section. The table system supports 3-dimisional tables, DLL function externs, parameters, constants, linear gains, and products. It can also support a varying number of controls. For the QSRA the number of controls is 36 as of August 23, 2006, as listed in Controls List.xls for reference. The block contains the s-function aerodyn_1_0, which handles the table-lookup in C++. Because this block handles the constants of the aircraft, it also provides the Radii of Gyration and Mass for the integrator. Figure 3: Aerodynamics Block Mask Parameters The s-function aerodyn_1_0 takes one parameter: the name of the table file (default: simtable). This parameter is provided by the Airplane Mask Dialog, where it can be changed to implement the desired aircraft. The name of the QSRA table file is QSRA_Full_Table_(Latest Date), which as of now is QSRA_Full_Table_08_23_06.txt. Input Ports There are 10 input ports into the aerodyn_1_0: Name Control Inputs Speed of Sound Density Altitude Altitude Orientation Velocities Omegas Wind Velocities Wind Accelerations Model Reset Trigger Units radians feet/second slug/feet^3 feet radians feet/second radians/second feet/second feet/second^2 Bool Frame n/a n/a n/a LHLV LHLV Body Body LHLV LHLV n/a Width Number of controls 1 1 1 3 3 3 3 3 1 Tag Name ElevatorAileronRudder SpeedOfSound Density LLA PhiThetaPsi uvw pqr windV windA reset Output Ports There are 6 output ports from aerodyn_1_0: Name Forces and Moments Alpha and Beta Coefficients Airspeed Radii of gyration(sp) Units pounds and pounds/foot Radians Unitless feet/second Feet Frame Body Body n/a LHLV Body Width 6 2 6 and parameters 3 6 Tag Name n/a(Output) AlphaBeta n/a(Display) uvwAirspeed rGrayation Mass of aircraft slugs n/a 1 Mass Files The aerodynamics files contain constants about the aircraft, followed by the tables. This is the header of the table, and it required the following format: Name Take-off Gross Weight Wing Area Wing Span Wing Chord Radius of gyration( about x Radius of gyration(about y Radius of gyration(about z Products of Inertia about xy Products of Inertia about xz Products of Inertia about yz Number of Controls Type of controls Units/Options Note pounds feet^2 feet feet feet feet feet feet feet feet n/a There should be a type for each control, each on a new line. The details about each control type are as follows: Normal No action is taken Trans_Deunit Rot_Deunit Number of parameters Number of tables n/a n/a Trans_Deunit – Deunitizes by dividing by q and Wing Area Rot_Deunit – Deunitizes by divinding by q, Wing Area, and Wing Chord Must be correct Warning: Order matters for the file header. The file reader assumes the order and reads appropriately. If you miss a value or put them out of order the file reader may throw an error, or the values will be wrong for the simulation. In the actual text version that is implemented in the simulation, the header will look as follows: 39000 530 38.7 16 4.5411 lb 10.036 10.751 0.0 1.348 0.0 3 Normal Normal Normal 0 22 // TOGW (lbf) // Area (ft^2) // Span (ft) // Chord (ft) // rx (ft) Ixx = 25000 slug ft^2 Weight = 39000 // ry (ft) Iyy = 1.22E+05 slug ft^2 // rz (ft) Izz = 1.40E+05 slug ft^2 // rxy // rxz (ft) Ixz = 2200 slug ft^2 // ryz // Number of Controls (Elevator, Aileron, Rudder) // Number of Parameters () // Number of Tables Each table must start with what it affects. There are 7 possibilities: Keyword (case-sensitive) CL CD Cy Cl Cm Cn Parameter n Name/Note Lift Coefficient Drag Coefficient Side Force Coefficient Roll Moment Coefficient Pitch Moment Coefficient Yaw Moment Coefficient Parameter Number n (0-indexed) On the next line you specify what type of lookup it is. There are 6 types of supported tables: Keyword (case-sensitive) Table FunctionBoth the function name and library name are case sensitive. Linear Purpose Adds a value from a one to three dimensional table lookup, with interpolation, and optional extrapolation to the given parameter Adds the return value of dynamic library function to the given parameter Adds a variable times a constant to a given parameter Adds a several variables multiplied together to a given parameter Product Abs Constant Adds the absolute value of the product of a variable and a constant Adds a constant value to the given parameter In the QSRA simulation only Tables, Products, Functions and Constants are used. The functions and products are listed in a file named Product Terms and functions.txt. The code in this text file is later added to the QSRA_Full _Table to obtain the final input for the aerodynamic parameters (under Sim Table) in the Airplane block. For the lookups you can use the following variables: Keyword (case-sensitive) Alpha Beta Mach Airspeed Altitude Name Angle-of-Attack Sideslip Angle Mach Number True Airspeed Altitude Above Sea-Level Units/Note radians radians n/a feet/second feet Keyword (case-sensitive) p Name Non-Dimensional Roll Rate q Non-Dimensional Pitch Rate r Non-Dimensional Yaw Rate AlphaDot Non- Dimensional Rate of Change of Angle-of-Attack Non-Dimensional Rate of Change of Sideslip Angle BetaDot CL CD Cy Cl Cm Cn Parameter n Control n Lift Coefficient Drag Coefficient Side Force Coefficient Roll Moment Coefficient Pitch Moment Coefficient Yaw Moment Coefficient Parameter Number n Control Number n Units/Note pb pˆ 2V T qc qˆ 2 V T rb rˆ 2 V T ˆ c 2V T ˆ b 2VT n/a n/a n/a n/a n/a n/a 0-indexed 0-indexed Table The “Table” lookup-type is the mainstay of the table-lookup system, and is also the most complex. To demonstrate how to make a table this manual will take apart one that is already done. CL Table 2 Alpha 3 -5 0 Mach 0 0.5 0 5 3 1 .2 .5 .8 1.5 1.7 2.4 .8 1.0 1.5 0 After the “Table” keyword line, you need to put the number of dimensions, or axis variables. The next 2 lines are the axis definitions. On the first line of the axis definition, you need to provide three pieces of information’s with a space or tab in between: The Parameter keyword (Alpha, Beta, Parameter #, etc) The number of data points in that axis Whether to extrapolate that axis On the second line of the axis definition you define the axis points for that axis, each values separated by a space or tab. Warning: You need to ensure that the number of data points listed on the first line of the definition matches the number of axis points on this line Below is one complete axis definition, with three data points, and no extrapolation. Alpha 3 -5 0 0 5 Warning: You must have the number of axis definitions as you listed on line three of the table definition. Below is an example of what the actual table would look like: Take notice that the first variable goes across the table horizontally. The second variable (if there is one) goes down the table, vertically. Last the third variable (if there is one) is each table, one after another. In summary, this is the general format for the tables: Line # 1 2 3 4 5-6 What should be there? A Parameter keyword “Table” Number of dimensions Blank for clarity Variable definition Variable name, axis length, to extrapolate Axis definition Repeat 5-6 for each variable. Following Table Function The “Function” lookup-type uses a function from a dynamic library and adds it the given parameter. On the line after the “Function” keyword, you need to specify the number of variables to pass to the function. If you do not specify the correct number of variables to pass into the function, the program may crash. The next lines should be the parameters you want to pass to the function. After the variables, you need to specify the name of the library. You should not add any system specific extensions. These will be added automatically. For reference: Library Name System In the file In the File System QSRA_LIB Windows QSRA_LIB QSRA_LIB.dll -nux systems QSRA_LIB libQSRA_LIB.so Note: You must place the dynamic library in the MATLAB working directory, or it will generate an error. The next line is the function located in the library. Warning: Both the function name and library name are case sensitive. Example: CL Function 4 Alpha Control 5 Control 3 Parameter 4 QSRA_LIB CL_function Product The “Product” lookup-type adds the product of several variables, parameters, controls and a constant value to the given parameter. After the parameter and “Product” keyword, the next line is the number of variables. The following lines are the variables to be multiplied together. Below is an example: Cm Product 4 CL Parameter 1 Alpha Control 23 0.1 // Pitch Moment Coefficient (Cm General Parameter) // // // // // // 4 Variables Lift Coefficient Wing Arm (ft) Angle of Attack The 4th variable… Constant that variables are multiplied by Complete Example File 39000 530 38.7 16 4.5411 10.036 10.751 0.0 1.348 0.0 3 Normal Normal Normal 1 22 // TOGW (lbf) // Area (ft^2) // Span (ft) // Chord (ft) // rx (ft) Ixx = 25000 slug ft^2 Weight = 39000 // ry (ft) Iyy = 1.22E+05 slug ft^2 // rz (ft) Izz = 1.40E+05 slug ft^2 // rxy // rxz (ft) Ixz = 2200 slug ft^2 // ryz // Number of Controls (Elevator, Aileron, Rudder) // Number of Parameters () // Number of Tables CL Table 2 Alpha 3 -5 0 Mach 0 0.5 0 5 3 1 .2 .5 .8 1.5 1.7 2.4 .8 1.0 1.5 0 CL Function 4 Alpha Control 0 Control 1 Control 2 QSRA_LIB CL_function Cm Constant -0.01 // Cm0 CL Linear AlphaDot 0.000 // CLAlphaDotHat Cm // Pitch Moment Coefficient Product 2 // 2 Variables CL // Lift Coefficient Parameter 0 // Wing Arm (ft) 0.1 // 1/Chord Operations Manual The QSRA Operations Manual, Boeing document number D340-13801 is very useful for understanding through textual description of the systems of the QSRA, and how they are operated. This is an integral part of being able to model the aircraft. Additional Notes Current Model Observations 6-27-06 There are many aerodynamic model graphs that reference the deflection of the i’th USB flap. This would seem to indicate that the USB flaps could potentially be positioned differently. However, the flight manual indicates that the only reason that the USB flaps would be in the case of an actuator failure, in which case the flap position monitor circuit would shutdown the flap actuator, preventing further position disagreement. For now, SimTables will be set up with provisions for each of 4 USB flap positions and also for a reference flap position. This will provide for the best future expandability, but for now the same value will be passed through for all USB flap deflections Left and right outboard flaps (non-USB) must be treated seperatly because in the event of an engine failure in the landing configuration, the flap trim switch is used to retract the flap opposite the engine failure to reduce the rolling moment due to asymmetric blown lift Each of four spoilers must be treated separately, spoilers have 4 functions… See Opps manual. The landing gear of the QSRA has been made non-retractable. QSRA airspeed redline (Do Not Exceed Speed) is 190 kts. Simlab Observations 6-27-06 Stick outputs from the SimLab pilot input are scaled from analogue -1 to +1. Current provisions for aerodynamic forces and moments may only be designed to be input in tabular form. Aerodynamic parameters in QSRA math model are given in both tabular and equation form. Further research is needed to determine the format for passing equations into the SDOF model. Simlab model format has changed significantly from last year. Porting of current model is in progress. The SimLab does not have nearly enough lever controls or switches to properly fly the QSRA. A “engineers” control panel has been designed in the Simulink model to address this issue, but depending of evolving requirements for an accurate simulation, more physical controls may be desired. Need to find out sign conventions of SimLab