Example #1
0
def comp_Ncspc(self, Zs=None):
    """Compute the number of coils in series per parallel circuit

    Parameters
    ----------
    self : Winding
        A Winding object
    Zs : int
        number of slot

    Returns
    -------
    Ncspc: float
        Number of coils in series per parallel circuit

    """
    if Zs is None:
        if self.parent is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object."
            )

        if self.parent.slot is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object with Slot."
            )

        Zs = self.parent.slot.Zs

    (Nrad, Ntan) = self.get_dim_wind()
    Ncspc = Zs * Nrad * Ntan / (2.0 * self.qs * self.Npcpp)

    return Ncspc
Example #2
0
def comp_Ntspc(self, Zs=None):
    """Compute the number of turns in series per phase

    Parameters
    ----------
    self : Winding
        A Winding object
    Zs : int
        Number of slot

    Returns
    -------
    Ntspc: float
        Number of turns in series per phase

    """
    if Zs is None:
        if self.parent is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object.")

        if self.parent.slot is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object with Slot."
            )

        Zs = self.parent.slot.Zs

    Ncspc = self.comp_Ncspc(Zs)

    return Ncspc * self.Ntcoil
Example #3
0
def comp_connection_mat(self, Zs=None):
    """Compute the Winding Matrix (for winding type 10)
    type 10 : Squirrel cage Winding (elementary circuit loop involving bar n°1
    and bar n°Zr for alphar0_rad=0) (Nlay_rad=Nlay_tan=1)

    Parameters
    ----------
    self : Winding
        A: Winding object
    Zs : int
        Number of Slot (Integer >0)

    Returns
    -------
    numpy.ndarray
        Winding Matrix (Nlay_rad, Nlay_tan, Zs, qs)

    Raises
    ------
    WindingT10DefQsError
        qs must be equal to Zs

    """
    if Zs is None:
        if self.parent is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object.")

        if self.parent.slot is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object with Slot."
            )

        Zs = self.parent.slot.Zs

    assert Zs > 0, "Zs must be >0"
    assert Zs % 1 == 0, "Zs must be an integer"

    if self.qs != Zs:
        raise WindingT10DefQsError("wrong winding definition, you must have "
                                   "qs = Zs !")

    wind_mat = zeros((1, 1, Zs, self.qs))

    for ii in range(Zs):
        # phase n°ii
        wind_mat[0, 0, ii, ii] = -1
        wind_mat[0, 0, (ii - 1) % Zs, ii] = 1

    # Apply the transformations
    if self.is_reverse_wind:
        wind_mat = reverse_wind_mat(wind_mat)
    if self.Nslot_shift_wind > 0:
        wind_mat = shift_wind_mat(wind_mat, self.Nslot_shift_wind)

    return wind_mat
Example #4
0
def comp_initial_angle(self):
    """Compute initial angle between the d-axis and the alpha-axis of the machine

    Parameters
    ----------
    self : MachineSync
        A: MachineSync object
    
    Returns
    -------
    init_angle: float
        initial angle between rotor orientated coordinate system (dq) and stator orientated coordinate system (alpha-beta)

    Raises
    ------
    

    """
    if self.stator.winding is None:
        raise WindingError("ERROR: The Machine object must contain a Winding object.")

    Zs = self.stator.slot.Zs
    p = self.stator.winding.p

    stator_ang = self.stator.winding.comp_phasor_angle()[0] / p + pi / Zs - pi / (2 * p)
    rotor_ang = pi / (2 * p)

    return stator_ang - rotor_ang
Example #5
0
def comp_connection_mat(self, Zs=None):
    """Compute the Winding Matrix (for winding type 3 or 4) (Nlay_rad=1 or 2,Nlay_tan=1)
    type 3 or 4 : DISTRIBUTED SHORTED PITCH INTEGRAL WINDING

    Parameters
    ----------
    self : Winding
        A: Winding object
    Zs : int
        Number of Slot (Integer >0)

    Returns
    -------
    wind_mat: numpy.ndarray
        Winding Matrix (1 or 2, 1, Zs, qs)

    Raises
    ------
    WindingDefMsError
        Zs/2/p/qs must be an integer

    """
    if Zs is None:
        if self.parent is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object.")

        if self.parent.slot is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object with Slot."
            )

        Zs = self.parent.slot.Zs

    assert Zs > 0, "Zs must be >0"
    assert Zs % 1 == 0, "Zs must be an integer"

    coil_pitch = self.coil_pitch
    p = self.p
    nlay = self.get_dim_wind()[0]
    qs = self.qs
    ms = Zs / 2.0 / float(p) / float(qs)
    tausp = Zs / 2.0 / float(p)
    Ntcoil = self.Ntcoil  # number of turns per coils
    wind_mat = zeros((nlay, 1, Zs, qs))

    if qs == 3:
        phase_order = [1, -3, 2]
    else:
        phase_order = range(1, qs + 1)
    if ms % 1 != 0:  # if ms isn't an integer
        raise WindingDefMsError("wrong winding definition, Zs/2/p/qs must "
                                "be an integer !")
    ms = int(ms)
    tausp = int(tausp)  # if ms is an integer, tausp is

    # shorted pitch Nlay-layered integral overlapping windings
    for nl in range(0, nlay):
        for i in range(0, p):
            for k in range(0, qs):
                ph = abs(phase_order[k])
                # cf Gieras p36
                z = (arange(1, ms + 1) + i * (Zs / p) + k * ms + nl *
                     (coil_pitch - tausp))

                sp = ((z - 1) % Zs).astype(int)  # positive pole
                sm = ((z + Zs / 2 / p - 1) % Zs).astype(int)  # negative pole
                for s in sp:
                    wind_mat[nl, 0, s, ph - 1] = Ntcoil * sign(
                        phase_order[k])  # Accumulation for a single slot
                for s in sm:
                    wind_mat[nl, 0, s, ph - 1] = -Ntcoil * sign(
                        phase_order[k])  # Accumulation for a single slot

    # Apply the transformations
    if self.is_reverse_wind:
        wind_mat = reverse_wind_mat(wind_mat)
    if self.Nslot_shift_wind > 0:
        wind_mat = shift_wind_mat(wind_mat, self.Nslot_shift_wind)

    return wind_mat
Example #6
0
def comp_connection_mat(self, Zs=None):
    """Compute the Winding Matrix (for winding type 1)
    type 1 : TOOTH WINDING, DOUBLE LAYER ALL TEETH WOUND, ORTHORADIAL
    SUPERPOSITION  (Nlay_rad=1,Nlay_tan=2)

    Parameters
    ----------
    self : Winding
        A: Winding object
    Zs : int
        Number of Slot (Integer >0)

    Returns
    -------
    wind_mat: numpy.ndarray
        Winding Matrix (Nlay_rad, Nlay_tan, Zs, qs)

    Raises
    ------
    WindingT1DefMsError
        You must have 0.25< Zs/2/p/qs <= 0.5

    """
    if Zs is None:
        if self.parent is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object.")

        if self.parent.slot is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object with Slot."
            )

        Zs = self.parent.slot.Zs

    assert Zs > 0, "Zs must be >0"
    assert Zs % 1 == 0, "Zs must be an integer"

    # ex "Effect of Pole and Slot Combination on Noise and Vibration in Permanent
    # Magnet Synchronous Motor" creates highest harmonic at Zs/2+1 and Zs/2-1
    nlay = 2.0
    qs = float(self.qs)
    p = float(self.p)
    Ncgr = Zs / nlay / qs
    ms = Zs / 2.0 / p / qs
    # Ncspc= Zs/(2.0*qs*self.Npcpp/nlay)  # number of coils in series per parallel circuit
    # Ntspc = self.Ntcoil * Ncspc #Number of turns in series per phase
    Ntcoil = self.Ntcoil  # number of turns per coils

    wind_mat = zeros((1, 2, Zs, int(qs)))
    # creates highest harmonic at Zs/2+1 and Zs/2-1
    if ms == 0.5:  # then Zs/qs is integer
        # traditional non overlapping all teeth wound winding
        for q in range(0, int(qs)):
            for k in range(0, int(Zs / qs)):  # number of Ncgr coils
                xenc = -(q) + array([1, 0]) - (k) * qs
                wind_mat[0, 0, int(mod(xenc[0] - 1, Zs)),
                         q] = +Ntcoil  # right / top / 2
                wind_mat[0, 1, int(mod(xenc[1] - 1, Zs)),
                         q] = -Ntcoil  # left / bottom / 1
    elif ms != 0.5 and Ncgr % 1 == 0:
        # ms!=0.5 and Ncgr is an integer (ms>0.25 && ms<0.5)
        # new algorithm to reverse the coils
        for q in range(0, int(qs)):
            for k in range(0, int(nlay)):  # number of Ncgr coils
                for l in range(0, int(Ncgr)):
                    wind_mat[
                        0, 1,
                        int(mod((q) * Ncgr + (k) * qs * Ncgr - 1 + (l), Zs)),
                        q] = (-((-1)**(l + q - 1 + k)) * Ntcoil
                              )  # left / bottom / 1
                    wind_mat[
                        0, 0,
                        int(mod(
                            (q) * Ncgr + 1 + (k) * qs * Ncgr - 1 + (l), Zs)),
                        q, ] = (+((-1)**(l + q - 1 + k)) * Ntcoil
                                )  # right / top / 2

    else:
        raise WindingT1DefMsError("Winding geometry not handled yet, enter "
                                  "your own winding matrix with type_winding=0"
                                  " and contact EOMYS")

    # Apply the transformations
    if self.is_reverse_wind:
        wind_mat = reverse_wind_mat(wind_mat)
    if self.Nslot_shift_wind > 0:
        wind_mat = shift_wind_mat(wind_mat, self.Nslot_shift_wind)

    return wind_mat
Example #7
0
def comp_connection_mat(self, Zs=None):
    """Compute the Winding Matrix (for winding type 0)
    Type 0 : User defined

    Parameters
    ----------
    self : Winding
        A: Winding object
    Zs : int
        Number of Slot (Integer >0)

    Returns
    -------
    wind_mat: numpy.ndarray
        Winding Matrix (Nlay_rad, Nlay_tan, Zs, qs)

    Raises
    ------
    WindingT0DefSumError
        the sum of the element in user_wind_mat
        must be null
    WindingT0DefShapeError
        user_wind_mat shape must be (Nlay_rad,
        Nlay_tan,Zs,qs)

    """
    if Zs is None:
        if self.parent is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object.")

        if self.parent.slot is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object with Slot."
            )

        Zs = self.parent.slot.Zs

    assert Zs > 0, "Zs must be >0"
    assert Zs % 1 == 0, "Zs must be an integer"

    wind_mat = self.user_wind_mat

    shape = wind_mat.shape
    if shape[2] != Zs:
        raise WindingT0DefShapeError("wrong winding definition, wrong "
                                     "user_wind_mat shape, must be (Nlay_rad, "
                                     "Nlay_tan, Zs,qs), Zs = " + str(Zs) +
                                     " but " + str(shape) + " given !")
    elif shape[3] != self.qs:
        raise WindingT0DefShapeError("wrong winding definition, wrong "
                                     "user_wind_mat shape, must be (Nlay_rad, "
                                     "Nlay_tan, Zs,qs), qs = " + str(self.qs) +
                                     " but " + str(shape) + " given !")

    if wind_mat.sum() != 0:
        raise WindingT0DefSumError("wrong winding definition, the sum of the "
                                   "element in user_wind_mat isn't null !")

    # Apply the transformations
    if self.is_reverse_wind:
        wind_mat = reverse_wind_mat(wind_mat)
    if self.Nslot_shift_wind > 0:
        wind_mat = shift_wind_mat(wind_mat, self.Nslot_shift_wind)

    return wind_mat
Example #8
0
def comp_connection_mat(self, Zs=None):
    """Compute the Winding Matrix (for winding type 2)
    type 2 : TOOTH WINDING, SINGLE LAYER ALTERNATE TEETH WOUND
    (Nlay_rad=1,Nlay_tan=1)

    Parameters
    ----------
    self : Winding
        A: Winding object
    Zs : int
        Number of Slot (Integer >0)

    Returns
    -------
    wind_mat: numpy.ndarray
        Winding Matrix (1, 1, Zs, qs)

    Raises
    ------
    WindingT2DefNtError
        Zs/qs/2 must be an integer

    """
    if Zs is None:
        if self.parent is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object.")

        if self.parent.slot is None:
            raise WindingError(
                "ERROR: The Winding object must be in a Lamination object with Slot."
            )

        Zs = self.parent.slot.Zs

    assert Zs > 0, "Zs must be >0"
    assert Zs % 1 == 0, "Zs must be an integer"

    # non overlapping ALTERNATE TEETH WOUND-> single layer
    # cf "2D exact analytical model for surface-mounted permanent-magnet motors
    # with semi-closed slots" -> U motor 10p/18s creates 2p, Zs/2+2p, Zs/2-2p

    qs = self.qs  # Phase Number
    Nt = Zs / float(qs) / 2.0  # Number of teeth by semi phase

    # Ncspc= Zs/(2.0*qs*self.Npcpp/nlay)  # number of coils in series per parallel circuit
    # Ntspc = self.Ntcoil * Ncspc #Number of turns in series per phase
    Ntcoil = self.Ntcoil  # number of turns per coils

    if round(Nt) != Nt:  # Nt must be an integer
        raise WindingT2DefNtError("wrong winding definition, cannot wind all "
                                  "the teeth (Zs/qs/2 is not an integer)!")

    # first strategy - checked with Umbra_08 motor and Umbra_05: the winding
    # direction of each tooth is reversed
    wind_mat = zeros((1, 1, Zs, qs))

    for k in range(0, int(Nt)):  # winding alternatively the teeth
        for q in range(0, qs):
            xenc = q * 2 + k * 2 * qs + array([1, 2])
            wind_mat[0][0][int(
                (xenc[0] - 1) % Zs)][q] = (power(-1, xenc[0] + q + k + 1) *
                                           Ntcoil)
            wind_mat[0][0][(xenc[1] - 1) %
                           Zs][q] = (power(-1, xenc[1] + q + k + 1) * Ntcoil)

    # Apply the transformations
    if self.is_reverse_wind:
        wind_mat = reverse_wind_mat(wind_mat)
    if self.Nslot_shift_wind > 0:
        wind_mat = shift_wind_mat(wind_mat, self.Nslot_shift_wind)

    return wind_mat