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

.. only:: html

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

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

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

.. _sphx_glr_grid_examples_identification_plot_10kva_gfl_identification.py:


10-kVA, GFL, converter output admittance identification
=======================================================

This example demonstrates converter output admittance identification using a 10-kVA
grid-following (GFL) converter.

.. GENERATED FROM PYTHON SOURCE LINES 11-13

.. code-block:: Python

    from motulator.grid import control, model, utils








.. GENERATED FROM PYTHON SOURCE LINES 14-15

Compute base values based on the nominal values.

.. GENERATED FROM PYTHON SOURCE LINES 15-19

.. code-block:: Python


    nom = utils.NominalValues(U=400, I=14.5, f=50, P=10e3)
    base = utils.BaseValues.from_nominal(nom)








.. GENERATED FROM PYTHON SOURCE LINES 20-21

Configure the identification.

.. GENERATED FROM PYTHON SOURCE LINES 21-33

.. code-block:: Python


    identification_cfg = utils.IdentificationCfg(
        abs_u_e=0.01 * base.u,
        f_start=1,
        f_stop=10e3,
        n_freqs=100,
        T_s=1 / 10e3,
        # Uncomment the row below to save identification results in "project root"/data
        # filename="gfl_admittance",
        filetype="csv",
    )








.. GENERATED FROM PYTHON SOURCE LINES 34-35

Configure the system model.

.. GENERATED FROM PYTHON SOURCE LINES 35-41

.. code-block:: Python


    ac_filter = model.LFilter(L_f=0.2 * base.L)
    ac_source = model.ThreePhaseSource(w_g=base.w, e_g=base.u)
    converter = model.VoltageSourceConverter(u_dc=650)
    mdl = model.GridConverterSystem(converter, ac_filter, ac_source)








.. GENERATED FROM PYTHON SOURCE LINES 42-43

Configure the control system.

.. GENERATED FROM PYTHON SOURCE LINES 43-53

.. code-block:: Python


    inner_ctrl = control.CurrentVectorController(
        i_max=1.5 * base.i, L=0.2 * base.L, T_s=identification_cfg.T_s
    )
    ctrl = control.GridConverterControlSystem(inner_ctrl)

    # Set the references
    ctrl.set_power_ref(0.5 * base.p)
    ctrl.set_reactive_power_ref(0.5 * base.p)








.. GENERATED FROM PYTHON SOURCE LINES 54-55

Run the identification and plot results.

.. GENERATED FROM PYTHON SOURCE LINES 55-59

.. code-block:: Python


    res = utils.run_identification(identification_cfg, mdl, ctrl)
    utils.plot_identification(res, plot_style="re_im")
    utils.plot_vector_identification(res, base)



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


    *

      .. image-sg:: /grid_examples/identification/images/sphx_glr_plot_10kva_gfl_identification_001.png
         :alt: plot 10kva gfl identification
         :srcset: /grid_examples/identification/images/sphx_glr_plot_10kva_gfl_identification_001.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /grid_examples/identification/images/sphx_glr_plot_10kva_gfl_identification_002.png
         :alt: plot 10kva gfl identification
         :srcset: /grid_examples/identification/images/sphx_glr_plot_10kva_gfl_identification_002.png
         :class: sphx-glr-multi-img

    *

      .. image-sg:: /grid_examples/identification/images/sphx_glr_plot_10kva_gfl_identification_003.png
         :alt: plot 10kva gfl identification
         :srcset: /grid_examples/identification/images/sphx_glr_plot_10kva_gfl_identification_003.png
         :class: sphx-glr-multi-img






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

   **Total running time of the script:** (5 minutes 36.860 seconds)


.. _sphx_glr_download_grid_examples_identification_plot_10kva_gfl_identification.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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