motulator_multiphase.control
============================

.. py:module:: motulator_multiphase.control

.. autoapi-nested-parse::

   Control of multi-three-phase machine drives.

   The common mode of the three-phase sets is controlled by the vector controllers of
   three-phase machines, and the differential modes are current-controlled.

   ..
       !! processed by numpydoc !!


Classes
-------

.. autoapisummary::

   motulator_multiphase.control.DifferentialModeController
   motulator_multiphase.control.DifferentialModeSignals
   motulator_multiphase.control.ExternalReferences
   motulator_multiphase.control.Measurements
   motulator_multiphase.control.MultiThreePhaseControlSystem


Module Contents
---------------

.. py:class:: DifferentialModeController(L_ls, n_sets = 2, alpha_c = 2 * pi * 200, alpha_i = None, T_s = None)

   
   Current controller of the differential modes.

   Each DM is a resistive-inductive circuit with the leakage inductance `L_ls`. The DM
   currents are controlled in the coordinates of the vector controller using the
   flux-linkage-based complex-vector 2DOF controllers, in the same manner as in the
   current controllers of motulator. The DM current references correspond to the
   current-sharing coefficients of the sets, i.e., the reference of the set k is
   `k_share[k]*i_cm`, where `i_cm` is the common-mode current.

   :param L_ls: Leakage inductance (H) of a set.
   :type L_ls: float
   :param n_sets: Number of three-phase sets, defaults to 2.
   :type n_sets: int, optional
   :param alpha_c: Current-control bandwidth (rad/s), defaults to 2*pi*200.
   :type alpha_c: float, optional
   :param alpha_i: Integral-action bandwidth (rad/s), defaults to `alpha_c`. Not used in the
                   direct discrete-time design.
   :type alpha_i: float, optional
   :param T_s: Sampling period (s). If given, the direct discrete-time design is used instead
               of the continuous-time design. The vector controller must then be a direct
               discrete-time design as well (`k_comp = 0`), since the angle advance of the
               voltage references is common to all modes, and its sampling period must equal
               this value.
   :type T_s: float, optional















   ..
       !! processed by numpydoc !!

   .. py:method:: compute_output(i_cm, i_dm)

      
      Compute the DM current references and voltage references.
















      ..
          !! processed by numpydoc !!


   .. py:method:: set_sharing(k_share)

      
      Set the current-sharing coefficients, summing up to the number of sets.
















      ..
          !! processed by numpydoc !!


   .. py:method:: update(T_s, dm, w_c)

      
      Update the integral states using the realized or limited DM voltages.
















      ..
          !! processed by numpydoc !!


.. py:class:: DifferentialModeSignals

   
   DM signals in the controller coordinates, each of shape (n_sets - 1,).
















   ..
       !! processed by numpydoc !!

.. py:class:: ExternalReferences

   
   External reference signals.
















   ..
       !! processed by numpydoc !!

.. py:class:: Measurements

   
   Measured signals.
















   ..
       !! processed by numpydoc !!

.. py:class:: MultiThreePhaseControlSystem(vector_ctrl, dm_ctrl, speed_ctrl = None, theta_sets = None, pwms = None)

   Bases: :py:obj:`motulator.common.control.ControlSystem`\ [\ :py:obj:`motulator_multiphase.model.MultiThreePhaseDrive`\ , :py:obj:`Measurements`\ , :py:obj:`References`\ , :py:obj:`Feedbacks`\ ]


   
   Vector control system of multi-three-phase machine drives.

   The control is based on the decoupled multi-stator (DMS) transformation, which maps
   the three-phase sets to the common mode (CM) and the differential modes (DMs)
   [#Rub2021]_. The CM is controlled by the given vector controller of a three-phase
   machine, see :func:`~motulator_multiphase.utils.to_parallel`. Its feedback signals
   are the CM voltage and the current of the equivalent machine, i.e., the sum of the
   set currents. The DMs are controlled by the DM current controller in the
   coordinates of the vector controller. Each set has its own PWM. As in
   `VectorControlSystem`, the angles of the voltage references are advanced by
   `k_comp*T_s*w_c`, where `k_comp` is given by the vector controller, and the speed
   controller and the external references work in the same manner. The DM signals are
   logged in the signal group `dm`, see :class:`DifferentialModeSignals`, with the
   shape (N, n_sets - 1). In the post-processed time series, they are in the same
   coordinates as the signals of the vector controller (e.g., in the estimated rotor
   flux coordinates for induction machines).

   :param vector_ctrl: Vector controller of the CM, configured with the parameters of the
                       parallel-connected equivalent machine.
   :type vector_ctrl: VectorController
   :param dm_ctrl: Current controller of the DMs.
   :type dm_ctrl: DifferentialModeController
   :param speed_ctrl: Speed controller. If None (default), torque-control mode is used.
   :type speed_ctrl: SpeedController | PIController | None, optional
   :param theta_sets: Angles (rad) of the phases a of the sets, defaults to the asymmetrical
                      arrangement.
   :type theta_sets: Sequence[float], optional
   :param pwms: Pulse-width modulators of the sets, defaults to `PWM()` for each set.
   :type pwms: Sequence[PWM], optional

   .. rubric:: References

   .. [#Rub2021] Rubino, Dordevic, Armando, Bojoi, Levi, "A novel matrix transformation
      for decoupled control of modular multiphase PMSM drives," IEEE Trans. Power
      Electron., 2021, https://doi.org/10.1109/TPEL.2020.3043083















   ..
       !! processed by numpydoc !!

   .. py:method:: compute_output(fbk)

      
      Compute the references and the duty ratios of the sets.
















      ..
          !! processed by numpydoc !!


   .. py:method:: compute_standby_output(fbk)

      
      Compute the controller output while the gates are blocked.
















      ..
          !! processed by numpydoc !!


   .. py:method:: get_command(ref)

      
      Extract the sampling period and the duty ratios from the references.
















      ..
          !! processed by numpydoc !!


   .. py:method:: get_feedback(meas)

      
      Get the feedback signals.
















      ..
          !! processed by numpydoc !!


   .. py:method:: get_measurement(mdl)

      
      Sample the sensors, the speed and position sensors if the drive has them.
















      ..
          !! processed by numpydoc !!


   .. py:method:: post_process()

      
      Extend the post-process method.
















      ..
          !! processed by numpydoc !!


   .. py:method:: save(t, **signal_groups)

      
      Extend the base class method by saving the DM signals.
















      ..
          !! processed by numpydoc !!


   .. py:method:: set_current_sharing(ref_fcn)

      
      Set the current-sharing coefficients.

      :param ref_fcn: Coefficients of the sets, summing up to the number of sets, constant or a
                      function of time. Equal sharing, i.e., all coefficients equal to one, is
                      used by default.
      :type ref_fcn: Sequence[float] | Callable[[float], Sequence[float]]















      ..
          !! processed by numpydoc !!


   .. py:method:: set_speed_ref(ref_fcn)

      
      Set the external speed reference for speed-control mode.

      :param ref_fcn: Speed reference (mechanical rad/s), constant or a function of time.
      :type ref_fcn: float | Callable[[float], float]















      ..
          !! processed by numpydoc !!


   .. py:method:: set_torque_ref(ref_fcn)

      
      Set the external torque reference for torque-control mode.

      :param ref_fcn: Torque reference (Nm), constant or a function of time.
      :type ref_fcn: float | Callable[[float], float]















      ..
          !! processed by numpydoc !!


   .. py:method:: update(ref, fbk)

      
      Update the controller states.
















      ..
          !! processed by numpydoc !!


