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

.. only:: html

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

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

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

.. _sphx_glr_gat_plot_examples_09_transmission_loading.py:


Transmission Line Loading and Utilization
-----------------------------------------

Two transmission views:

1. **Loading ranked** — line loading (% of rating) sorted descending,
   showing which lines hit the highest utilization across the horizon.
2. **Utilization** — distribution of hours each line operates above
   threshold percentiles (90/95/99% of rating).

The Sienna RTS-GMLC fixture is solved with ``DCPPowerModel``, so the
simulation store carries ``FlowActivePowerVariable__Line`` data and
these plots work out of the box. The same calls work against a Plexos
scenario (``PlexosScenario(simulation_files=...)``) — the transmission
API is shared across scenario types.

.. GENERATED FROM PYTHON SOURCE LINES 18-49



.. image-sg:: /gat_plot_examples/images/sphx_glr_09_transmission_loading_001.png
   :alt: Line Loading — Ranked, Line Utilization Distribution
   :srcset: /gat_plot_examples/images/sphx_glr_09_transmission_loading_001.png
   :class: sphx-glr-single-img


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

 .. code-block:: none

    /home/runner/work/GridAnalysisToolkit/GridAnalysisToolkit/src/gat/datahelpers/sienna.py:381: UserWarning: StandardLoad was not found. Use one of the following components
      warnings.warn(message, UserWarning)
    ----- Available Components -----
    RenewableNonDispatch
    LoadZone
    RenewableDispatch
    FixedAdmittance
    ACBus
    Area
    VariableReserve
    TwoTerminalHVDCLine
    ThermalStandard
    Arc
    PowerLoad
    TapTransformer
    Line
    calculating loading
    calculating loading
    formatting dataframe






|

.. code-block:: Python

    import warnings

    warnings.filterwarnings("ignore", category=DeprecationWarning)

    import matplotlib.pyplot as plt

    from gat.scenariohandlers import SiennaScenario
    import gat.quickplots as qp

    # These examples use the in-repo Sienna RTS-GMLC fixture. Regenerate it via
    # `make sienna-fixture-v4`. For project-based workflows, use `gat.load(...)`
    # instead — see docs/source/python_api_load.md.
    sienna_v4 = "../../example_data/sienna/v4"
    scenario = SiennaScenario(
        simulation_files=f"{sienna_v4}/simulation_store.h5",
        system_file=f"{sienna_v4}/sys.json",
    )

    loading = scenario.get_line_loading()
    utilization = scenario.get_line_utilization()

    fig, axs = plt.subplots(1, 2, figsize=(14, 5))

    qp.plot_loading_ranked(loading, ax=axs[0])
    axs[0].set_title("Line Loading — Ranked")

    qp.plot_lines_utilization(utilization, ax=axs[1])
    axs[1].set_title("Line Utilization Distribution")

    plt.tight_layout()
    plt.show()


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

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


.. _sphx_glr_download_gat_plot_examples_09_transmission_loading.py:

.. only:: html

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

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

      :download:`Download Jupyter notebook: 09_transmission_loading.ipynb <09_transmission_loading.ipynb>`

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

      :download:`Download Python source code: 09_transmission_loading.py <09_transmission_loading.py>`

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

      :download:`Download zipped: 09_transmission_loading.zip <09_transmission_loading.zip>`


.. only:: html

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

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