.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "nesc_test_cases/nesc_case13p3.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_case13p3.py>`
        to download the full example code.

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

.. _sphx_glr_nesc_test_cases_nesc_case13p3.py:


===================================================
Case 13.3: Course 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=15s, command 15 degree right heading change
==============  ===============

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-51

.. code-block:: Python


    from simupy import systems
    import numpy as np
    from scipy import interpolate

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

    baseChiCmdBlock = systems.SystemFromCallable(
        interpolate.make_interp_spline(
            [0, 15],
            [spec_ic_args["psi"] * 180 / np.pi, spec_ic_args["psi"] * 180 / np.pi + 15.0],
            k=0,
        ),
        0,
        1,
    )

    BD.systems[-1] = baseChiCmdBlock
    BD.systems[2] = F16ControllerBlock(*opt_ctrl, sasOn=True, apOn=True, event_t=15.)

    with benchmark() as b:
        res = BD.simulate(30, integrator_options=int_opts)





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

 .. code-block:: none

    time to simulate: 32.485 s




.. GENERATED FROM PYTHON SOURCE LINES 52-55

.. code-block:: Python


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



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


    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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






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

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


.. _sphx_glr_download_nesc_test_cases_nesc_case13p3.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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