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

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

.. _sphx_glr_nesc_test_cases_nesc_case10.py:


=====================================================================
Case 10: Sphere launched ballistically northward along Prime Meridian
=====================================================================

==============  ===============
Verifies        Coriolis
Gravitation     J2
Geodesy         WGS-84 rotating
Atmosphere      US 1976 STD
Winds           still air
Vehicle         Sphere with constant :math:`C_D`
Notes           Initial velocity is :math:`\sqrt{2000}` ft/s aligned 45 degrees from
                vertical, heading north; zero angular rate relative to launch platform.
==============  ===============

.. GENERATED FROM PYTHON SOURCE LINES 17-115

.. code-block:: Python


    from simupy.block_diagram import BlockDiagram
    import simupy_flight
    import numpy as np

    from nesc_testcase_helper import plot_nesc_comparisons, int_opts, benchmark
    from nesc_testcase_helper import ft_per_m, kg_per_slug

    Ixx = 3.6 * kg_per_slug / (ft_per_m**2)  # slug-ft2
    Iyy = 3.6 * kg_per_slug / (ft_per_m**2)  # slug-ft2
    Izz = 3.6 * kg_per_slug / (ft_per_m**2)  # slug-ft2
    Ixy = 0.0 * kg_per_slug / (ft_per_m**2)  # slug-ft2
    Iyz = 0.0 * kg_per_slug / (ft_per_m**2)  # slug-ft2
    Izx = 0.0 * kg_per_slug / (ft_per_m**2)  # slug-ft2
    m = 1.0 * kg_per_slug  # slug

    x = 0.0
    y = 0.0
    z = 0.0

    S_A = 0.1963495 / (ft_per_m**2)
    b_l = 1.0
    c_l = 1.0
    a_l = b_l

    lat_ic = 0.0 * np.pi / 180
    long_ic = 0.0 * np.pi / 180
    h_ic = 0.0 / ft_per_m
    V_N_ic = 1000.0 / ft_per_m
    V_E_ic = 000.0 / ft_per_m
    V_D_ic = -1000.0 / ft_per_m
    psi_ic = 0.0 * np.pi / 180
    theta_ic = 0.0 * np.pi / 180
    phi_ic = 0.0 * np.pi / 180
    p_b_ic = 0.0 * np.pi / 180
    q_b_ic = 0.0 * np.pi / 180
    r_b_ic = 0.0 * np.pi / 180
    # omega_X_ic = 0.004178073*np.pi/180
    # omega_Y_ic = 0.*np.pi/180
    # omega_Z_ic = 0.*np.pi/180

    planet = simupy_flight.Planet(
        gravity=simupy_flight.earth_J2_gravity,
        winds=simupy_flight.get_constant_winds(),
        atmosphere=simupy_flight.atmosphere_1976,
        planetodetics=simupy_flight.Planetodetic(
            a=simupy_flight.earth_equitorial_radius,
            omega_p=simupy_flight.earth_rotation_rate,
            f=simupy_flight.earth_f,
        ),
    )

    vehicle = simupy_flight.Vehicle(
        base_aero_coeffs=simupy_flight.get_constant_aero(CD_b=0.1),
        m=m,
        I_xx=Ixx,
        I_yy=Iyy,
        I_zz=Izz,
        I_xy=Ixy,
        I_yz=Iyz,
        I_xz=Izx,
        x_com=x,
        y_com=y,
        z_com=z,
        x_mrc=x,
        y_mrc=y,
        z_mrc=z,
        S_A=S_A,
        a_l=a_l,
        b_l=b_l,
        c_l=c_l,
        d_l=0.0,
    )

    BD = BlockDiagram(planet, vehicle)
    BD.connect(planet, vehicle, inputs=np.arange(planet.dim_output))
    BD.connect(vehicle, planet, inputs=np.arange(vehicle.dim_output))

    planet.initial_condition = planet.ic_from_planetodetic(
        lamda_D=long_ic,
        phi_D=lat_ic,
        h=h_ic,
        V_N=V_N_ic,
        V_E=V_E_ic,
        V_D=V_D_ic,
        psi=psi_ic,
        theta=theta_ic,
        phi=phi_ic,
        p_B=p_b_ic,
        q_B=q_b_ic,
        r_B=r_b_ic,
    )
    # planet.initial_condition[-3:] = omega_X_ic, omega_Y_ic, omega_Z_ic
    planet.initial_condition[-2] = 0.0

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





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

 .. code-block:: none

    time to simulate: 1.669 s




.. GENERATED FROM PYTHON SOURCE LINES 116-118

.. code-block:: Python


    plot_nesc_comparisons(res, "10")



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


    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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

    *

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






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

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


.. _sphx_glr_download_nesc_test_cases_nesc_case10.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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