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

.. only:: html

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

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

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

.. _sphx_glr_drive_examples_grid_connection_plot_2kw_im_dol.py:


2.2-kW IM, direct-on-line start
===============================

This example simulates the direct-on-line start of a 2.2-kW induction machine (IM),
whose stator is connected directly to a stiff grid. The machine drives a fan, whose
load torque is proportional to the square of the speed.

.. GENERATED FROM PYTHON SOURCE LINES 12-14

.. code-block:: Python

    from motulator.drive import model, utils








.. GENERATED FROM PYTHON SOURCE LINES 15-16

Compute base values based on the nominal values.

.. GENERATED FROM PYTHON SOURCE LINES 16-20

.. code-block:: Python


    nom = utils.NominalValues(U=400, I=5, f=50, P=2.2e3, tau=14.6)
    base = utils.BaseValues.from_nominal(nom, n_p=2)








.. GENERATED FROM PYTHON SOURCE LINES 21-23

Configure the system model. The machine is connected to the grid at the start, when
the phase-a voltage is at its peak.

.. GENERATED FROM PYTHON SOURCE LINES 23-33

.. code-block:: Python


    par = model.InductionMachineInvGammaPars(
        n_p=2, R_s=3.7, R_R=2.1, L_sgm=0.021, L_M=0.224
    )
    machine = model.InductionMachine(par)
    k = nom.tau / base.w_M**2  # Quadratic load torque profile
    mechanics = model.MechanicalSystem(J=0.03, B_L=lambda w_M: k * abs(w_M))
    ac_source = model.ThreePhaseSource(w_g=base.w, e_g=base.u)
    mdl = model.GridConnectedMachine(machine, mechanics, ac_source)








.. GENERATED FROM PYTHON SOURCE LINES 34-36

Create the simulation object, simulate, and plot the results in per-unit values. The
currents and voltages are plotted as the magnitudes of their space vectors.

.. GENERATED FROM PYTHON SOURCE LINES 36-41

.. code-block:: Python


    sim = model.Simulation(mdl)
    res = sim.simulate(t_stop=0.5)
    utils.plot(res, base)




.. image-sg:: /drive_examples/grid_connection/images/sphx_glr_plot_2kw_im_dol_001.png
   :alt: plot 2kw im dol
   :srcset: /drive_examples/grid_connection/images/sphx_glr_plot_2kw_im_dol_001.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 42-44

Plot the stator voltage and currents during the start. The currents contain decaying
DC components, which depend on the instant of the connection.

.. GENERATED FROM PYTHON SOURCE LINES 44-46

.. code-block:: Python


    utils.plot_stator_waveforms(res, base, t_lims=(0, 0.1))



.. image-sg:: /drive_examples/grid_connection/images/sphx_glr_plot_2kw_im_dol_002.png
   :alt: plot 2kw im dol
   :srcset: /drive_examples/grid_connection/images/sphx_glr_plot_2kw_im_dol_002.png
   :class: sphx-glr-single-img






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

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


.. _sphx_glr_download_drive_examples_grid_connection_plot_2kw_im_dol.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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