Vous êtes sur la page 1sur 9

University of Minnesota UAV Simulation

Introduction
This document describes in detail the UAV simulation developed by the UAV Research Group at the University of Minnesota. The UAV simulation model is written in the Matlab/Simulink environment using the Aerospace Blockset. Three simulation environments are maintained: a basic nonlinear simulation, a Software-In-the-Loop simulation, and a Processor-In-the-Loop simulation. All three simulations share the same plant dynamics, actuator, sensor, and environmental models via Simulink Libraries. Aircraft and environmental parameters are set in m-files and shared between the simulations. Two aircraft models are maintained, one for the Ultra Stick 25e and one for the FASER aircraft.

Directory Layout
The simulation directory is arranged into the following subdirectories: Analysis- analysis scripts for use with the simulations Libraries- holds all of the common files that are shared across all three simulations NL_Sim- Nonlinear simulation model. SIL_Sim- Software-In-the-Loop simulation model. PIL_SIm- Processor-In-the-Loop simulation model.

Simulation Descriptions
Nonlinear Simulation (UAV_NL.mdl)
The nonlinear simulation has the Nonlinear UAV Model only (no actuators or sensor models). Top level inputs and outputs are used for generating and storing trim conditions and linear models. The trim condition generated with this model is used for the other simulations. The aircraft configuration, trim condition, and linear models are stored in the Libraries directory.

The following is a description of all of the m-files used with the nonlinear simulation. setup.m This script sets the aircraft configuration by calling the function UAV_config.m with the aircraft name as the input; two data structures are returned, one each for the aircraft and environment parameters. A trim condition is set using a data structure, and the model is trimmed by calling trim_UAV.m, passing the desired trim condition and aircraft data structure. Linear models and transfer functions are then generated by calling linearize_UAV.m, passing the trim condition operating point. UAV_config.m Function used to set the aircraft parameter data structure (AC) and environment data structure (Env). Input the desired aircraft (Ultrastick or FASER). The data structures are saved as UAV_modelconfig.mat in the Libraries directory. This data is then used to initialize the SIL and PIL simulations. Ultrastick_config.m Function that sets the aircraft parameter data structure (AC) for the Ultra Stick 25e. This includes the mass properties, geometry, linear aerodynamic derivatives, motor model, sensor models, and actuator models. The FASER aerodynamic model can be used by setting the Boolean flag AC.Aero.use_FASER_aero in this function to 1.

FASER_config.m Function that sets the aircraft parameter data structure (AC) for the FASER aircraft. This includes the mass properties, geometry, nonlinear aerodynamic model (loaded from a .mat file), motor model,sensor models, and actuator models. The Ultrastick linear aerodynamic model can be used by setting the Boolean flag AC.Aero.use_FASER_aero in this function to 0. trim_UAV.m Function used to trim the nonlinear UAV model using Simulink Control Design functions. Input a desired trim condition and aircraft data structure. A TrimCondition data structure is returned which is used to initialize the nonlinear UAV model. An OperatingPoint object is also returned for use with the linearization function. Depending on the trim condition desired, the function must be modified to set the trim condition targets as known or unknown and whether they are steady state. Output trim conditions can also be used. The TrimCondition and OperatingPoint variables are automatically saved as UAV_trimcondition.mat in the Libraries directory. This data is then used to initialize the SIL and PIL simulations. linearize_UAV.m Function used to create linear models and transfer functions around an OperatingPoint returned by the trim_UAV function. The state order of the Simulink model is important here! A full 13 state linear model, as well as reduced order decoupled longitudinal and lateral-directional linear models are returned. From these reduced order models relevant transfer functions are generated and returned in a data structure (TF). The output variables are automatically saved as UAV_linearmodel.mat in the Libraries directory. example1.m An example script that trims the model to a level flight condition and then compares the doublet response from the full nonlinear simulation and the full and decoupled linear models.

Software-in-Loop Simulation (UAV_SIL.mdl)


The SIL simulation includes the plant dynamics, actuators, sensors, time delays, and the flight controller C-code in a MEX-function, as shown in the following figure. The trim condition from the NL_Sim is used to initialize the model. The flight controller commands are added to the trim inputs.

The Flight Data Display block contains scopes for plotting and saving data. The Flight Software block contains the flight controller C-code in a MEX-function. The following is a description of all of the m-files used with the SIL simulation. setup.m This script sets the aircraft configuration and trim condition by loading two files from the Libraries directory, UAV_modelconfig.mat and UAV_trimcondition.mat. The sample time of the simulation and the flight software is set in this script, as is the value of the time delay in the flight control loop. The flight controller MEX function is also compiled. plot_SIL.m This script runs the SIL simulation for 60 seconds, saves the data, and plots the results. The results can be compared to the data and .pdf document in SIL_Sim\Verification\.

Processor-in-Loop Simulation (UAV_PIL.mdl)


The PIL simulation is the same as SIL, but instead of just the flight controller, this simulation has PWM and serial hardware interfaces to connect it to the flight computer. This simulation also has a connection to FlightGear for visualizing the aircraft state using tools from the Aerospace Blockset. The trim condition from the NL_Sim is used to initialize the model. The hardware control commands are added to the trim inputs.

The following is a description of all of the m-files used with the PIL simulation. setup.m This script sets the aircraft configuration and trim condition by loading two files from the Libraries directory, UAV_modelconfig.mat and UAV_trimcondition.mat. The sample time of the simulation and the flight software is set in this script, as is the value of the time delay in the flight control loop. The serial communication MEX-file is compiled as well.

Simulink Model Overview


The following section describes the Simulink models in brief detail.

Nonlinear UAV Model (NonlinearModel_Lib.mdl)


This library is the primary plant dynamics block that is shared between the simulation environments. The majority of this block is simply links to other libraries. Inputs to this block is the Control Inputs bus; Outputs are the State and EnvData busses. Detailed lists of the components of these buses can be found in UAV_sim_ICD.xlsx. Each signal in these buses has the units embedded in the signal name (e.g. States.Euler [rad].phi [rad]). This block is a masked subsystem; the parameter inputs are initial states and parameters for the equations of motion (EOM), navigation, propulsion, and aerodynamic models, listed as follows: Parameter Default Value Description

Initial velocities Initial angular rates Initial attitude Initial position Initial Lat/Lon Initial engine speed Ground altitude Aero Model Selection

TrimCondition.VelocitiesIni TrimCondition.RatesIni TrimCondition.AttitudeIni TrimCondition.InertialIni TrimCondition.LLIni TrimCondition.EngineSpee dIni Env.GroundAlt AC.Aero.use_FASER_aero

Vector of initial values for body-axis velocities Vector of initial values for body-axis angular velocities Vector of initial values for Euler angles Vector of initial values for inertial position Vector of initial values for latitude/longitude (deg) Initial value for motor speed integrator Height of the ground above Mean Sea Level (MSL) Boolean switch to select which aerodynamic model is used

The primary components within this block are the Forces and Moments, 6DOF equations of motion, Auxiliary Equations, and Environment model, as shown below.

Forces and Moments This subsystem contains library links and block interconnections to the three main force and moment models: Aerodynamic, Gravity, and Propulsion. One important note is the Aerodynamic model is a Configurable Subsystem to allow switching between aero models. The top level subsystem mask Initialization commands contains a short if-else statement to switch the aerodynamic model.

Inputs to this subsystem are the Control Inputs, States, and EnvData buses. Outputs are Total Force, Total Moment, and nonGravForces. All are 3-element vectors, with units in [N] and [N-m], as appropriate. The nonGravForces are used to calculate accelerometer sensor readings. Aerodynamic Forces & Moments (Aero_Lib.mdl) This block is configurable subsystem library link that has two block choices: Ultrastick and FASER. These aero models are also contained in separate libraries. The aerodynamic force coefficients are in wind axes (lift, drag, and crosswind coefficients) FASER Aerodynamic Model (FASER_Aero_Lib.mdl) The FASER aerodynamic model utilizes a build up approach comprised of nonlinear lookup tables of aerodynamic coefficient increments, generally a function of angle of attack, sideslip angle, and advance ratio, and control surface position for the static aerodynamics and control surface effects. The exception is for the dynamic aero model, which is modeled using linear derivatives from empirical estimates. The aero data are stored in FASER_Aero.mat. Ultrastick Aerodynamic Model (Ultrastick_Aero_Lib.mdl) The Ultrastick aerodynamic model utilizes a build up approach comprised of linear derivatives from empirical estimates with some flight test updates. The linear derivatives are stored in Ultrastick_config.m. Gravitational Force (Gravity_Lib.mdl) This block is library link that contains one equation which computes the gravitational force using the DCM, gravity field, and aircraft mass.

Electric Propulsion Forces and Moments (Propulsion_Lib.mdl) This block is a library link that contains the motor model. The electric motor is modeled using a 1D table lookup between throttle position and motor power output. This is converted to a torque, and is used to drive the motor speed integrator. The fixed-pitch propeller models the thrust and torque characteristics as 1D table lookups of thrust and power coefficients (CT and CP) as functions of advance ratio J. Moments due to position relative to the aircraft CG and change in engine speed are also modeled. The lookup table data is stored in the aircraft-specific m-files, FASER_config.m and Ultrastick_config.m. 6DoF (Euler Angles) This block contains the 6DoF flat, non-rotating Earth, constant mass, rigid body equations of motion from the Aerospace Blockset. Units are Metric (MKS), mass type is Fixed, and Euler angles are used for attitude representation. This block has been modified to remove the inertial position and velocities from the equations and outputs. The default implementation does not allow the correct implementation of steady state winds, so these functions were moved the Auxiliary Equations block. Inputs to this block are the Total Forces and Total Moments. Outputs are the aircraft state data: Euler angles, the Direction Cosine Matrix (DCM), body axis velocities, accelerations, angular rates, and angular accelerations. Auxiliary Equations (AuxEq_Lib.mdl) This block is a library link that contains additional equations to compute parameters of interest from the aircraft state vector. This block also creates the States output bus. Important components of this block are the integration of winds and turbulence, navigation equations, wind axes parameters, and Euler angle rates. The Navigation block is a separate library, covered in the next section. Winds & Turbulence Implementation Steady state winds are added directly to the inertial/navigation frame velocities V_e. These are integrated to get the inertial position X_e. Non-steady winds (gusts & turbulence) are added directly to the body axis velocities (u,v,w), which are then used to calculate the angle of attack, sideslip angle, and airspeed. The turbulence angular velocities are added directly to the body axis angular rates. Navigation (Navigation_Lib.mdl) This block is library link that contains the navigational model and equations. Included are equations relating the flat Earth position to latitude/longitude, a simplified 2D table lookup version of the EGM-96 Geoid model for computation of MSL/AGL altitudes, and computation of flight path and ground track angles. Environment (Environment_Lib.mdl) This block is a library link that contains the environmental model.

The COESA Atmosphere Model from the Aerospace Blockset is used for air temperature, speed of sound, pressure, and density. The Winds block is a configurable subsystem, as is the Magnetic Model. The alternate block choices here are simple bypass blocks that have no internal states, which complicate the trim and linearization routines. The Winds block has three components: Steady Winds which are horizontal only, a Discrete Wind Gust Model, and a Dryden Wind Turbulence Model (Discrete (+q +r)). The latter two are from the Aerospace Blockset. Memory blocks are downstream of the latter two blocks to eliminate an inherent algebraic loop in the simulation, since these models depend on and affect the aircraft state data. Parameters for these models are set in the configuration m-files (UAV_config.m). Earths gravity and magnetic fields are modeled using the WGS84 Gravity Model and the World Magnetic Model 2005 from the Aerospace Blockset. Actuators (Actuator_Lib.mdl) This block is a library link that contains first order, rate and position limited actuator servo models. Actuator parameters are set in the aircraft-specific m-files. Currently the ailerons are modeled as a single actuator and no flap actuators are modeled. Trim Setting (Actuator_Lib.mdl) This block is library link which adds the trimmed actuator commands to the input signals. This is used in the SIL and PIL sims to ensure the aircraft starts in a trimmed condition. Sensors (Sensors_Lib.mdl) This block is a library link that models sensor noise, bias, and scale factor errors. These effects are modeled for the IMU sensor (angular rate, accelerations, magnetic field) and the air data system (airspeed and altitude). Sensor parameters are set in the aircraft-specific m-files. The sensor models can be toggled on/off by setting the Boolean AC.Sensors.NoiseOn. The default setting is ON.

Vous aimerez peut-être aussi