.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "nesc_test_cases/nesc_case13p2.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_nesc_test_cases_nesc_case13p2.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_nesc_test_cases_nesc_case13p2.py:


===================================================
Case 13.2: Velocity 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, decrease commanded 5 KEAS
==============  ===============

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.

.. GENERATED FROM PYTHON SOURCE LINES 20-46

.. code-block:: Python


    from simupy import systems
    from scipy import interpolate

    from nesc_testcase_helper import plot_nesc_comparisons, plot_F16_controls, benchmark
    from nesc_case11 import (
        int_opts,
        F16ControllerBlock,
        BD,
        opt_ctrl,
        dim_feedback,
        trimmed_KEAS,
    )

    keasCmdBlock = systems.SystemFromCallable(
        interpolate.make_interp_spline([0, 5], [trimmed_KEAS, trimmed_KEAS - 5.0], k=0),
        0,
        1,
    )

    BD.systems[-4] = keasCmdBlock
    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)





.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    time to simulate: 20.290 s




.. GENERATED FROM PYTHON SOURCE LINES 47-50

.. code-block:: Python


    plot_nesc_comparisons(res, "13p2")
    plot_F16_controls(res, "13p2")



.. rst-class:: sphx-glr-horizontal


    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_001.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_001.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_002.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_002.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_003.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_003.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_004.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_004.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_005.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_005.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_006.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_006.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_007.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_007.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_008.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_008.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_009.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_009.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_010.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_010.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /nesc_test_cases/images/sphx_glr_nesc_case13p2_011.png
         :alt: nesc case13p2
         :srcset: /nesc_test_cases/images/sphx_glr_nesc_case13p2_011.png
         :class: sphx-glr-multi-img






.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 25.493 seconds)


.. _sphx_glr_download_nesc_test_cases_nesc_case13p2.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: nesc_case13p2.ipynb <nesc_case13p2.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: nesc_case13p2.py <nesc_case13p2.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: nesc_case13p2.zip <nesc_case13p2.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_