8
1. Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2. Open MATLAB 3. Change to F16Sim directory 4. Mex the file nlplant.c using >> mex nlplant.c The above will create an executable (with a .mexw32 extension) that can then be embedded as a function in Simulink or used as just another function in MATLAB. You should see “nlplant.mexw32” in your directory. 5. Add “F16Sim” to MATLABPATH. Make sure you append the directory to the end of the path - > “File” -> “Set Path” -> Select “With sub-folders option” -> Move to bottom -> Save. 6. Create a Project Work directory, “AwesomeProject” - > change to this directory and perform/save designs here.

1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

Embed Size (px)

Citation preview

Page 1: 1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

1. Unzip the File F16Sim.zipThis will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations

2. Open MATLAB

3. Change to F16Sim directory

4. Mex the file nlplant.c using>> mex nlplant.c

The above will create an executable (with a .mexw32 extension) that can then be embedded as a function in Simulink or used as just another function in MATLAB. You should see “nlplant.mexw32” in your directory.

5. Add “F16Sim” to MATLABPATH. Make sure you append the directory to the end of the path - > “File” -> “Set Path” -> Select “With sub-folders option” -> Move to bottom -> Save.

6. Create a Project Work directory, “AwesomeProject” - > change to this directory and perform/save designs here.

7. >> runLinF16Sim

Page 2: 1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

The following list of commands will create the transfer functions for a) Altitude – elevator, b) bank angle – aileron, c) pitch angle – elevator and d) yaw angle

– rudder.

After you are done with runLINF16sim,

1. sys = ss(A,B,C,D); % Creates the large state space system object2. systf = tf(sys); % Converts the SS object to a Transfer Function object3. syshde = minreal(systf(3,2)); % Pulls out the Altitude – Elevator TF 4. sysphida = minreal(systf(4,3)); % Pulls out the Bank – Aileron TF 5. systhede = minreal(systf(5,2)); % Pulls out the Pitch – Elevator TF 6. syspsidr = minreal(systf(6,4)); % Pulls out the Yaw – Rudder TF 7. % Save into a file called design Project8. save designProject sys systf sysphida systhede syspsidr syshde

Example:

Pitch-Elevator Transfer function: -154.5 s^2 - 114.6 s - 1.452-------------------------------------------------------------------------------s^5 + 21.99 s^4 + 38.67 s^3 + 50.51 s^2 + 0.684 s + 0.3423

Page 3: 1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

Example (contd.)

Pitch-Elevator Transfer function: systhede

-154.5 s^2 - 114.6 s - 1.452-------------------------------------------------------------------------------s^5 + 21.99 s^4 + 38.67 s^3 + 50.51 s^2 + 0.684 s + 0.3423

>> damp(systhede)

Eigenvalue Damping Freq. (rad/s) i) -4.20e-003 + 8.26e-002i 5.08e-002 8.27e-002 ii) -4.20e-003 - 8.26e-002i 5.08e-002 8.27e-002 iii) -8.91e-001 + 1.30e+000i 5.66e-001 1.57e+000 iv) -8.91e-001 - 1.30e+000i 5.66e-001 1.57e+000 v) -2.02e+001 1.00e+000 2.02e+001

• The last eigenvalue corresponds to the actuator. • (i) and (ii) are characterized by low frequency and low damping (stable) and

correspond to the long period (Phugoid) mode.• (iii) and (iv) correspond to the short period mode.• DESIGN REQUIREMENT: Increase short period damping to 0.707

Page 4: 1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

• See if the DESIGN REQUIREMENT can be met using a simple proportional gain (K).

• Perform this analysis using the Root Locus method we just discussed in class.

• Plot the step response for a unit elevator deflection using ‘systhede’ with and without the control element.

• Can you place the closed loop poles (short period only) such that they have a damping of 0.707 and frequency of 2 rad/s?

• What happens to the other roots if you meet the above objective?

• Document your analysis.

• For those who have unstable systhede, you need to find a way to stabilize the system as well as satisfy the DESIGN REQUIREMENT.

Page 5: 1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

• The following requirements can be used as a guideline for your controller design for the project

• Longitudinal Dynamics • Stable Phugoid (Long period)• Short period dynamics• Damping ratio between 0.5 – 0.85• Frequency between 2.0 – 5.0 rad/s

• Lateral-Directional Dynamics• Stable roll subsidence• Stable spiral• Stable Dutch Roll• Damping ratio – at least 0.3• Frequency – at least 1.5 rad/s• Real part of the dutch roll poles – at least 0.35

Page 6: 1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

• Each team will design the following autopilots,• Pitch displacement autopilot (consider )

• Altitude hold autopilot (consider )• hc is the commanded altitude• It is desirable that the achieved altitude has less than 5 percent

overshoot . • Roll autopilot to achieve a desired bank angle and a yaw damper

to improve the Dutch Roll PerformanceHINTS: • Good pitch displacement can be achieved by using a PD

element in the feedback path and a PI element in the forward path (after the summing junction).

• Once the pitch displacement autopilot is done, consider altitude hold autopilot with the pitch loop closed.

• For the Yaw-Damper you may use in the feedback path and a simple gain after the summing junction. Find appropriate values for T and the Gain to get desirable properties.

)(

)(

s

s

e

)(

)(

sh

sh

c

1Ts

s

Page 7: 1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

PROJECT REPORT

1. Cover page with names of the team members and signatures.

2. The main body of the text should be formatted 11 pt, Times New Roman with 1 inch margin on all sides.

3. The following items must be summarized – Flight condition at with the design was performed, Design requirements, Transfer functions employed for design, Analysis of the transfer functions, Specific actions taken to improve performance, Choice of control elements (why did you choose those elements), Final controller transfer functions, Simulation results.

4. Provide details of the contributions from each team member when you are organizing the report.

5. For simulation, you will build a Simulink diagram using the Complete System with 4 control inputs (Thrust, Elevator, Aileron, Rudder) and 12 outputs (North, East, Down, Roll, Pitch, Yaw, Velocity, AoA, AoS, Roll Rate, Pitch Rate, Yaw Rate). Fix the Controls and all the other States at the trim values obtained from earlier work. Add the control elements to this and simulate the system. (See Figure)

Page 8: 1.Unzip the File F16Sim.zip This will create a directory F16Sim and it will contain all the files needed to perform the non-linear simulations 2.Open MATLAB

DEMUX Block

V

1

Trim Thrust

1

Trim Rudder

1

Trim Elevator

1

Trim Aileron

s+0.1

s+1Theta Feedback

Theta

1

Ref Altitude

R - Yaw Rate

Q - Pitch Rate

PsiPhi

s+0.1

sPI (altitude)

20s+0.2

s+0.1PI (Theta)

P - Roll rate

North

H

East

Angle of SideSlip

Angle of Attack

x' = Ax+Bu y = Cx+Du

12 State Aircraft State Space