Note
Go to the end to download the full example code.
Case 13.1: Altitude change of a subsonic aircraft
Verifies |
Multidimensional table look-up |
Gravitation |
J2 |
Geodesy |
WGS-84 rotating |
Atmosphere |
US 1976 STD |
Winds |
still air |
Vehicle |
F-16 with simple auto-pilot |
Notes |
Initially straight & level. t=5s, command altitude 100-ft increase |
For the manuevering examples, the BlockDiagram from case 11 is modified to replace the controller with the auto-pilot configuration and generate the appropriate command signals.
from simupy import systems
from scipy import interpolate
from nesc_testcase_helper import plot_nesc_comparisons, plot_F16_controls, benchmark
from nesc_testcase_helper import ft_per_m
from nesc_case11 import (
int_opts,
F16ControllerBlock,
BD,
spec_ic_args,
opt_ctrl,
dim_feedback,
)
altCmdBlock = systems.SystemFromCallable(
interpolate.make_interp_spline(
[0, 5],
[spec_ic_args["h"] * ft_per_m, spec_ic_args["h"] * ft_per_m + 100.0],
k=0,
),
0,
1,
)
BD.systems[-3] = altCmdBlock
BD.systems[2] = F16ControllerBlock(*opt_ctrl, sasOn=True, apOn=True, event_t=5.)
with benchmark() as b:
res = BD.simulate(20, integrator_options=int_opts)
Optimization terminated successfully.
Current function value: 0.006500
Iterations: 291
Function evaluations: 554
pitch: 2.6351e+00 roll: 0.0000e+00 longStk: 12.9236 throttle: 13.7561
accelerations:
[[-4.59609832e-03 4.59610301e-03 2.09229079e-09]
[-2.98437663e-09 -1.70643291e-09 2.12618714e-09]]
time to simulate: 20.365 s
plot_nesc_comparisons(res, "13p1")
plot_F16_controls(res, "13p1")
Total running time of the script: (0 minutes 26.229 seconds)