Initial_Piccolo_gain_set_and_Simulation_model

advertisement

Initial Piccolo Gain Set for a New Aircraft

Dan Edwards dan.edwards@nrl.navy.mil

, 202.404.7623

U.S. Naval Research Laboratory

Vehicle Research Section

5/28/2009

Purpose

To have a good initial set of gains, we must have a good simulation model. This simulation model gives us the initial gain set via a program called Fixed-Wing-Gen-2 (FWG2) contained in the CCT simulator.

Running software in the loop (SWIL) test lets us do more tuning on the ground, since we have an accurate representation of the aircraft.

The method documented here has been used rather successfully for three aircraft, including a rudderonly vehicle.

Procedure

The process for getting an initial Piccolo setup can take anywhere from a single day to a week, depending on the complexity of the aircraft and the familiarity with this process. Most notably, the aircraft and a reasonable set of measurement tools (tape measure, level) are needed, but a CAD model will often suffice if the aircraft is not readily available.

Step 1: Create an AVL model

The first step is to create an aero model of the aircraft using a free code called Athena Vortex Lattice

(AVL). This program is good at overall configuration development and is useful for computing stability derivatives and trim conditions, so it may come in handy other than for just the simulation model. The original AVL model entry is a text file following a specific format and keywords. The folks at Cloud Cap have created a graphical wrapper for AVL to speed up this process.

Start by opening AVL Editor and creating a new model. First, go to “Model -> Edit Aircraft Data” and enter a vehicle name, cruising speed, and an initial guess on parasitic drag (0.003 for a glider, 0.02 for a dirty powered aircraft). Also, make a decision now about the measurement reference location.

Typically, this will be the leading edge of the wing, or the spinner tip. All measurements need not come from here, but this will be your AVL origin. Once decided, measure the offset from this point to the aircraft CG (you may need to measure the vertical CG). Enter the CG offset from the AVL origin, recalling

AVL axes are +X downstream, +Y out the right wing, and +Z up. The AVL Editor can calculate the reference area, span, and chord or you can enter it in manually.

Now, the aircraft airfoils should be loaded/entered using “Model -> Edit Airfoils”. I have not had luck with the NACA airfoil option, so I highly suggest finding coordinate files for every airfoil used on the aircraft. Save these .dat files in the same folder as your AVL model and load them individually using the

“Load” button.

Next, the aircraft geometry must be entered using “Model -> Edit Surfaces”. First, create a “New

Surface” and name it (wing, horizontal, or vertical). For this example, we will be making a four-surface wing. Now you need to know how many sections your wing will be entered in. Each time you make a chord change, have a control surface, or have an airfoil change, tally an additional surface. A foursurface wing with an unflapped center root section will have seven sections: left tip, left ail/flp break, left flp break, root section, right flp break, right ail/flp break, right tip. Note if you have sections at the tips without ailerons, add two additional sections for the left/right ail breaks. Now knowing the number of sections you need, use the “New Section” button and insert sections after the last section (after

Section 2 initially, then after Section 3, etc). This ensures the sections are consecutively numbered, which makes editing easier.

Decide now where the wing reference origin will be. This is easy typically at the root leading edge.

Measure the distance from this reference to the AVL origin and enter the offset under “Geometric

Translation”. Now is also a good time to enter the wing incidence relative to the AVL axes; I typically choose AVL axis to be the aircraft sitting on its landing gear or some such convenient stance. Note if the airfoil files have built-in incidence, factor that into the value being entered into the Incidence Angle box.

Now the wing geometry must be entered section by section. Starting at the LEFT and working RIGHT

(bottom to top for vertical surfaces), measure carefully from the wing reference location the leading edge position in three dimensions, the wing chord at this section, the incidence angle (such as a twisted wing might have relative to the root airfoil), and select the loaded airfoil from the list. This process must be very carefully repeated for each section. Hitting “Apply” will show the progress in the AVL graphical display.

Next, the control surfaces are added by selecting “New Control” and selecting each section that includes a control surface. Note that for the aileron/flap break, two controls must be applied to this section.

Scroll up to the section that includes the control surface and expand the “Control Surface” menu item.

First, give this surface a name (Laileron, Lflap, Lelevator, Lrudder, etc. FWG2 only recognizes a subset of these, so use conventional names). Enter the chord fraction as a positive number that represents the chord percentage aft of the leading edge where the control surface starts. For example, if the chord is

0.1m and the surface is 0.025m chord, enter 0.75 for the chord fraction. Also, ensure the surface gain is set as 1. For the hinge vector option, refer to the AVL manual. Enter this information in for each section with a control surface and hit the “Apply” button to watch the progress.

Last, select the “Vortex Lattice” option and modify the “Span Vortices” option. For a wing with several sections with tight spacing, a value of 150 is not uncommon (but takes a while to run). For a simple horizontal stabilizer, 20 sections are plenty. I typically use 100 sections for a wing.

Also, uncheck the “Y-symmetric” option at the top of the Surface Editor window. You can be brave and use this option to get away entering only n-1 sections.

Step 2: Run XFoil in the AVL Editor

After the aero geometry is entered, the wing/tail geometry will be analyzed using XFoil, a low-order panel code designed for 2D airfoil analysis. In particular to this application, XFoil is used to get the lift curve slope and the drag due to lift (CL vs CD) relationship. The AVL Editor wraps XFoil as well, which can be accessed using “Model -> XFoil analysis”. Select “File -> Start AVL” and enter a rough Reynolds number. I find changing to 100,000 often creates convergence issues, so I typically leave Renyolds number at one million. Select “OK” and watch XFOIL do its magic. If you see a lot of “Convergence

Failed” messages, you likely need to re-run with a larger Reynolds number.

After XFoil has run successfully, you should see a CD/CL plot and a CMalpha plot that look reasonable.

Beware if you have a very choppy CMalpha curve that the airfoil was likely not converging successfully.

Close the XFoil Output window and hit “Save” in the main AVL Model Editor window.

Step 3: Run an alpha-sweep to get the simulation aero coefficients

Next, the overall vehicle coefficients should be determined, once again using a wrapped version of AVL.

Select “Model -> AVL Analysis” and select “File -> Start AVL”. You will be prompted to save a file; name this “alpha.xml”.

Step 4: Create a Piccolo Simulator model

Now the simulator needs to know how to use these aero coefficients, by virtue of a full simulation model. This model includes an aero model, control surface mapping, a propulsion model, mass properties, contact points, and sensor configurations. An attached example format should be used for simplicity and to guide the process.

Control Surface Mapping

Following the format, the first item to enter is the control surface mapping. This is important to ensure the Piccolo knows which surfaces to move. You will need to ensure that the mapping here matches what the Piccolo has under the Aircraft Configuration tab to avoid some very frustrating behaviors. It is easiest to wire the Piccolo up with the standard control surface numbering and this will match the example format below. If you only have on rudder, for instance, use the lowest channel number rudder.

Beware that the simulator numbering is 0-indexed and the PCC numbering is 1-indexed as well as AVL is

1-indexed.

The simulator model includes next wing reference area and span, both of which you can get from AVL

Editor under “Model -> Edit Aircraft Data” when you leave the “Manually specify” button unchecked. If you have an odd geometry such as a lifting body, you can enter this information in manually both in the

AVL Editor and the Simulator model.

Mass Model

Mass properties are next, which should represent the flight airframe both with fuel (gross) and without

(empty). An electric plane would have both of these the same. The Piccolo keeps track of fuel burn and updates its mass estimate during flight, which is very important if you have a high mass fraction of fuel.

Moments of inertia are important for non-dimensionalizing several of the gains, so it is important to have these in the right ballpark. If a suitably high fidelity CAD model exists, most programs will output the mass moments of inertia (not to be confused with polar moments). You can also measure specific components (left wing, right wing, tail, fuse, engine, etc) and their locations to a reference point and build up an AVL .mass file to have AVL perform the parallel axis theorem math to find the total moment of inertia. To use this, you will have to run AVL and find its Ixx, Iyy, Izz, and Ixz estimates. An easy route for smaller vehicles is to do an inertia swing. This method is outlined in great detail in the NACA report

467: “The Experimental Determination of the Moments of Inertia of Airplanes.” Essentially you will need two equations:

𝐼 𝑐𝑔

=

𝑇 2 𝑚𝑔𝐿

4𝜋 2

− 𝑚𝐿

2

For the compound pendulum to get roll and pitch inertias and also:

𝐼 𝑐𝑔

=

𝑇

2 𝑚𝑔𝐿

4𝜋 2

For the bifilar pendulum to get the yaw inertia. This method typically is more focused on getting an appropriate rig to hold and swing the plane as well as measuring the vertical CG accurately. A good CAD models can likely get within 10% if the extremities in particular are modeled accurately.

Propulsion Model

The propulsion model is next and depends on if you have an electric or a gas motor setup. For simplicity, the example shown is for an electric propulsion system. Most of these values are available from the manufacturer, such as the RPM constant. I am unsure how big of a difference it makes to have a very accurate propulsion model in the simulator other than for engine gain tuning.

If you have a gas motor setup, most inputs are the same except you specify a look up table for watts versus RPM. This look up table you likely will need to run the actual aircraft and take data with a tachometer and a pull-scale, then convert force to horsepower using propeller information.

Propeller modeling is another non-trivial activity. I will fill this in later. For now, CCT provides a simple

Matlab script to scale APC props up/down to a user-specified size. This likely gets with 25% of the actual propeller, and is suggested if you simply need a reasonable starting point.

Ground Contact Points

The ground contact points input is for the simulator to know when the aircraft hits the ground. I typically don’t care about this because I want the airplane in the air, so even the example format below is left as the default example from CCT.

Avionics Mounting

The avionics orientation is another easy place to have a snafu and get very odd simulator behavior. In particular, the Piccolo is happiest being aligned with the aircraft major axes, so long as you know the rotation sequence. Stare at the orientation of the stickers on the physical Piccolo box and figure out the rotations to standard aircraft conventions: x-positive in the direction of the tail, y-positive out the right wing, and z-positive toward the floor of the plane. Ideally, you should open PCC and use the angle conventions specified under “Aircraft Configuration -> Sensors tab”.

If your autopilot unit is significantly far from the aircraft CG (>0.5m), then also measure the Piccolo offset to the CG.

Launcher

Last, if you plan to use auto-launches such as off of a pneumatic rail launcher or hand-launch, then specify the launcher parameters. If you plan to wheel launch or always transition to flying from manual control in-flight, then zero the launcher parameters.

Step 5: Get initial gains from FWG2

Now that the simulator is done, we can get the gains! Open the simulator, go to “File -> Open Aircraft…” and find your simulator model. Next, select “Vehicle Data -> Fixed Wing Gen 2…” and save off a file called “date-FWG2.xml”. Done with the initial gains!

Step 6: Apply these gains to set up a new aircraft full configuration

To use the FWG2 output, you must upload the FWG2 file in PCC to the “Window -> Controller

Configuration -> Vehicle tab”. This is ALL the FWG2 file is good for. Under the Lateral and Longitudinal

Gains tabs, start with “Set All to Defaults” and the FWG2 output. For most standard configurations, these default gains and the FWG2 output from the simulator model are close enough to get your aircraft in the air flying circles! For more tuning and verifying the FWG2 values are correct, you are now on your own.

Conclusions

By creating an aero model in AVL, this allows a simple CCT simulation model that uses good aero data.

The CCT simulation model is then run through the Fixed-Wing-Gen-2 tool provided in the CCT Simulator.

This FWG2.xml file populates the Controller Configuration -> Vehicle tab in the Piccolo Command

Center. Using this FWG2 output and the default gains should work well enough for most conventional configurations to get the airplane in the air and flying hands-off. More tuning can be accomplished in

Software-in-the-loop simulation using the aircraft sim model, or you can simply fly the aircraft and attempt to tune in the sky. Congrats and good luck!

Appendix 1: Piccolo Simulator Model

// SIMULATOR MODEL

// Format Based on:

// Arcturus T-15 with electric propulsion and AVL aerodynamics

// Cloud Cap Technology, 11/21/2006

Actuators=StandardActuator.txt

Sensors=SensorPlus.txt

//-------------------- AERODYNAMICS --------------------//

// Aerodynamics data from AVL

Alpha_sweep_xml_file=alpha.xml

// Mapping of the channel numbers in AVL to channel numbers

// Left Aileron

Channel_d1=0

// Left Flap

Channel_d2=4

// Right Flap

Channel_d3=9

// Right Aileron

Channel_d4=5

// Elevator

Channel_d5=1

// Rudder

Channel_d6=3

// Reference area, in m^2

Wing_Area=0.99677

// Span, in m

Wing_Span=4.3586

//-------------------- INERTIA --------------------//

// Gross take-off mass of the aircraft, in kg

Gross_Mass=5.25

// Mass of aircraft without fuel, in kg

Empty_Mass=5.25

// Moments of inertia

Roll_Inertia=2.510

Pitch_Inertia=0.8605

Yaw_Inertia=3.343

Roll_Yaw_Coupled_Inertia=-0.0179

//-------------------- PROPULSION --------------------//

// Electric motor Neu 1105/3Y/6.7:1

// Battery 4s4p LiPo cells @ 3.7 V each

Left_Engine_Type=1

Left_Engine_Channel=2

Left_Motor_NominalInputVoltage=14.8

Left_Motor_RPMConstant=3500

Left_Motor_NoLoadCurrent=0.65

Left_Motor_TerminalResistance=0.039

Left_Motor_ThermalResistance=1.3

Left_Motor_RotorInertia=0.03

// Propeller is CAM 13x10

Left_Actuator_Type=0

Left_Actuator_X=0.6858

Left_Actuator_Tilt=-4.0

Left_Actuator_Pan=0

Left_Actuator_Diameter=0.3302

Left_Actuator_Inertia=0.000285

Left_Actuator_GearRatio=6.7

Left_Prop_LUT=CAM13x10.prd

Left_Prop_Diameter=0.3302

//--------------- GROUND CONTACT POINTS ---------------//

ContactPoint_Top_Position_X=0

ContactPoint_Top_Position_Y=0

ContactPoint_Top_Position_Z=-0.12

ContactPoint_Bottom_Position_X=0

ContactPoint_Bottom_Position_Y=0

ContactPoint_Bottom_Position_Z=0.1

ContactPoint_Nose_Position_X=0.57

ContactPoint_Nose_Position_Y=0

ContactPoint_Nose_Position_Z=0

ContactPoint_Tail_Position_X=-1.3

ContactPoint_Tail_Position_Y=0

ContactPoint_Tail_Position_Z=0

ContactPoint_LWing_Position_X=0

ContactPoint_LWing_Position_Y=-1.515

ContactPoint_LWing_Position_Z=-0.08

ContactPoint_RWing_Position_X=0

ContactPoint_RWing_Position_Y=1.515

ContactPoint_RWing_Position_Z=-0.08

ContactPoint_LStab_Position_X=-1.1813

ContactPoint_LStab_Position_Y=-0.205

ContactPoint_LStab_Position_Z=-0.33

ContactPoint_RStab_Position_X=-1.1813

ContactPoint_RStab_Position_Y=0.205

ContactPoint_RStab_Position_Z=-0.33

ContactPoint_Fin_Position_X=-1.13

ContactPoint_Fin_Position_Y=0

ContactPoint_Fin_Position_Z=-0.33

LeftWheel_Position_X=-0.0588

LeftWheel_Position_Y=-0.34

LeftWheel_Position_Z=0.3095

LeftWheel_Brakes_Channel=7

RightWheel_Position_X=-0.0588

RightWheel_Position_Y=0.34

RightWheel_Position_Z=0.3095

RightWheel_Brakes_Channel=7

NoseWheel_Position_X=0.2403

NoseWheel_Position_Y=0

NoseWheel_Position_Z=0.2921

NoseWheel_RudderWheelRatio=-1.0

NoseWheel_Steering_Channel=8

//--------------- AVIONICS MOUNTING ---------------//

IMU_Sensor_Yaw_Angle=180.0

IMU_Sensor_Pitch_Angle=0.0

IMU_Sensor_Roll_Angle=-90.0

IMU_Sensor_Position_X=0.15

IMU_Sensor_Position_Y=-0.01

IMU_Sensor_Position_Z=0.0

//----------------- LAUNCHER DETAILS -----------------//

Launcher_Length=0.0

Launcher_Initial_Force=0.0

Launcher_Final_Force=0.0

Launcher_Pitch=0.0

Download