motulator_multiphase.model
==========================

.. py:module:: motulator_multiphase.model

.. autoapi-nested-parse::

   Continuous-time models for multi-three-phase machine drives.

   Peak-valued complex space vectors are used. The voltages and currents of the
   three-phase sets are space vectors in the sets' own coordinates. The mechanical
   system models, the machine parameter classes, the modulators, and the simulation
   class of motulator are re-exported for convenience.

   ..
       !! processed by numpydoc !!


Classes
-------

.. autoapisummary::

   motulator_multiphase.model.MultiThreePhaseConverter
   motulator_multiphase.model.MultiThreePhaseDrive
   motulator_multiphase.model.MultiThreePhaseMachine


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

.. py:class:: MultiThreePhaseConverter(u_dc, n_sets = 2, modulator = None, sign = np.sign)

   Bases: :py:obj:`motulator.common.model.Converter`, :py:obj:`motulator.common.model.ControlledConverter`


   
   Lossless multi-three-phase converter with constant DC-bus voltage.

   The converter consists of `n_sets` three-phase converters sharing the DC bus. The
   switching states, voltages, and currents of each set are space vectors in the
   set's own coordinates. The duty ratios and the gate states of the legs are ordered
   set by set, `[a1, b1, c1, a2, ...]`. The modulator of *motulator* converts the
   duty ratios into the gate states, including the computational delay and the dead
   time. As in the three-phase converter, the switches are ideal except for the dead
   time: when a leg is blanked, its state is `(1 - sign(i))/2`. Gate blocking is not
   supported.

   :param u_dc: DC-bus voltage (V).
   :type u_dc: float
   :param n_sets: Number of three-phase sets, defaults to 2.
   :type n_sets: int, optional
   :param modulator: Modulator of the legs, e.g., `ZOH` or `CarrierComparison` of *motulator*.
                     Defaults to `ZOH()`, i.e., the switching-cycle averaged model without the dead
                     time and with the computational delay of one sampling period.
   :type modulator: TwoLevelModulator, optional
   :param sign: Function of the phase currents (A) determining the leg states during blanking,
                defaults to `np.sign`.
   :type sign: Callable[[np.ndarray], np.ndarray], optional















   ..
       !! processed by numpydoc !!

   .. py:method:: create_time_series(t)

      
      Create time series.
















      ..
          !! processed by numpydoc !!


   .. py:method:: extend_history(n, u_c_ab)

      
      Extend the history, the switching states held constant over `n` points.
















      ..
          !! processed by numpydoc !!


   .. py:method:: init_state_history()

      
      Initialize the history of the switching states.
















      ..
          !! processed by numpydoc !!


   .. py:method:: modulate(T_s, command)

      
      Convert the duty ratios to the gate states and their durations.

      :param T_s: Sampling period (s).
      :type T_s: float
      :param command: Duty ratios of the legs, shape (3*n_sets,).
      :type command: Any

      :returns: * **t_steps** (*ndarray, shape (N,)*) -- Durations of the intervals (s), summing to `T_s`.
                * **gates** (*ndarray, shape (N, 2, 3*n_sets)*) -- Gate signals of the upper switches and blanking signals in each interval.















      ..
          !! processed by numpydoc !!


   .. py:method:: rhs(t)

      
      No states.
















      ..
          !! processed by numpydoc !!


   .. py:method:: set_gates(gates)

      
      Set the switching states based on the gate state of an interval.
















      ..
          !! processed by numpydoc !!


   .. py:method:: set_outputs(t)

      
      Set output variables.
















      ..
          !! processed by numpydoc !!


.. py:class:: MultiThreePhaseDrive(machine, mechanics, converter, sensors = None)

   Bases: :py:obj:`motulator.common.model.Model`\ [\ :py:obj:`MultiThreePhaseConverter`\ ]


   
   Continuous-time model of a multi-three-phase machine drive.

   :param machine: Machine model.
   :type machine: MultiThreePhaseMachine
   :param mechanics: Mechanical system model.
   :type mechanics: MechanicalSystem | TwoMassMechanicalSystem | ExternalRotorSpeed
   :param converter: Converter model.
   :type converter: MultiThreePhaseConverter
   :param sensors: Sensors, see `DriveSensors`, defaults to ideal phase-current and DC-bus voltage
                   sensors. Sensored control also needs the speed and position sensors. The current
                   sensors measure the phase currents of all the sets, shape (3, n_sets), and
                   cannot have a bandwidth.
   :type sensors: DriveSensors, optional















   ..
       !! processed by numpydoc !!

.. py:class:: MultiThreePhaseMachine(par, L_ls, n_sets = 2, theta_sets = None)

   Bases: :py:obj:`motulator.common.model.Subsystem`


   
   Multi-three-phase machine model.

   The machine has `n_sets` three-phase winding sets. The model is based on the
   decoupled multi-stator (DMS) transformation, which maps the sets to the common mode
   (CM) and the differential modes (DMs) [#Rub2021]_, see
   :func:`~motulator_multiphase.utils.dms_matrix`. The CM is equivalent to a
   three-phase machine whose sets are connected in parallel. It is modeled by the
   three-phase machine model `cm` (`SynchronousMachine` or `InductionMachine`) with
   the parameters given by :func:`~motulator_multiphase.utils.to_parallel`. Each DM is
   a resistive-inductive circuit, consisting of the stator resistance and the leakage
   inductance `L_ls` of a set, which is not coupled to the other sets. The DMs produce
   no torque, and they are modeled in stationary coordinates. The states are those of
   the CM machine, followed by the DM flux linkages.

   :param par: Parameters of one three-phase set, when all sets carry equal currents.
   :type par: MachinePars
   :param L_ls: Leakage inductance (H) of a set, which is not coupled to the other sets.
   :type L_ls: float
   :param n_sets: Number of three-phase sets, defaults to 2.
   :type n_sets: int, optional
   :param theta_sets: Angles (rad) of the phases a of the sets, defaults to the asymmetrical
                      arrangement, see :func:`~motulator_multiphase.utils.default_set_angles`.
   :type theta_sets: Sequence[float], optional

   .. rubric:: Notes

   The resistance of the DMs is the stator resistance `par.R_s` of a set, which is the
   same in the Γ and inverse-Γ models of the induction machine.

   .. 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_currents(i_s_ab, psi_dm_ab)

      
      Compute the currents of the sets.

      :param i_s_ab: Current (A) of the parallel-connected machine, i.e., `n_sets` times the CM.
      :type i_s_ab: complex | ndarray, shape (N,)
      :param psi_dm_ab: DM flux linkages (Vs).
      :type psi_dm_ab: ndarray, shape (n_sets - 1,) or (n_sets - 1, N)

      :returns: Currents (A) of the sets in their own coordinates.
      :rtype: ndarray, shape (n_sets,) or (n_sets, N)















      ..
          !! processed by numpydoc !!


   .. py:method:: create_time_series(t)

      
      Create time series.
















      ..
          !! processed by numpydoc !!


   .. py:method:: extend_state_history(sol_y, index)

      
      Extend the state history, the CM states in the CM machine.
















      ..
          !! processed by numpydoc !!


   .. py:method:: init_state_history()

      
      Initialize the state history, the CM states in the CM machine.
















      ..
          !! processed by numpydoc !!


   .. py:property:: psi_dm_ab
      :type: numpy.ndarray

      
      DM flux linkages (Vs), shape (n_sets - 1,).
















      ..
          !! processed by numpydoc !!


   .. py:method:: rhs(t)

      
      Compute state derivatives.
















      ..
          !! processed by numpydoc !!


   .. py:method:: set_outputs(t)

      
      Set output variables.
















      ..
          !! processed by numpydoc !!


   .. py:method:: set_states(state_list, index)

      
      Set the states, also those of the CM machine.
















      ..
          !! processed by numpydoc !!


