示例#1
0
    def __init__(self, machine, matlib=[], is_stator=False):
        """Initialize the GUI according to machine

        Parameters
        ----------
        self : SWPole
            A SWPole widget
        machine : Machine
            current machine to edit
        matlib : list
            List of available Material
        is_stator : bool
            To adapt the GUI to set either the stator or the rotor
        """

        # Build the interface according to the .ui file
        QWidget.__init__(self)
        self.setupUi(self)

        # Saving arguments
        self.machine = machine
        self.matlib = matlib
        self.is_stator = is_stator

        self.b_help.url = "https://eomys.com/produits/manatee/howtos/article/"
        self.b_help.url += "how-to-set-up-the-slots"

        # Avoid erase all the parameters when navigating though the slots
        self.previous_slot = {SlotW60: None, SlotW61: None}

        if self.is_stator:
            self.obj = machine.stator
        else:
            self.obj = machine.rotor

        # If the Slot is not set, initialize it with a SlotW60
        if self.obj.slot is None or type(self.obj.slot) not in INIT_INDEX:
            self.obj.slot = SlotW60()
            self.obj.slot._set_None()

        # Avoid error when loading WRSM with wrong rotor slot
        if type(self.obj.slot) not in INIT_INDEX:
            self.obj.slot = SlotW60()
            self.obj.slot._set_None()

        self.obj.slot.Zs = self.obj.winding.p * 2
        self.update_slot_text(self.obj.slot.Zs)

        # Set the correct index for the type checkbox
        index = NAME_INDEX.index(type(self.obj.slot).__name__)
        self.c_slot_type.setCurrentIndex(index)

        # Update the slot widget
        self.s_update_slot()

        # Connect the slot/signal
        self.c_slot_type.currentIndexChanged.connect(self.s_change_slot)
        self.b_plot.clicked.connect(self.s_plot)
示例#2
0
    def setUp(self):
        """Run at the begining of every test to setup the gui"""

        self.test_obj = MachineWRSM()
        self.test_obj.rotor = LamSlotWind(Rint=0.1, Rext=0.2)
        self.test_obj.rotor.slot = SlotW60(
            Zs=0, R1=0.10, H1=0.11, H2=0.12, W1=0.14, W2=0.15, H3=0.16, H4=0.17, W3=0.18
        )
        self.test_obj.rotor.winding.p = 4

        self.widget = SWPole(self.test_obj, matlib=[], is_stator=False)
示例#3
0
    def test_Lam_Wind_60(self):
        """Test machine plot with Slot 60
		"""
        print("\nTest plot Slot 60")
        plt.close("all")
        test_obj = Machine()
        test_obj.rotor = LamSlotWind(Rint=0,
                                     Rext=0.1325,
                                     is_internal=True,
                                     is_stator=False,
                                     L1=0.9)
        test_obj.rotor.slot = SlotW60(
            Zs=12,
            W1=25e-3,
            W2=12.5e-3,
            H1=20e-3,
            H2=20e-3,
            R1=0.1325,
            H3=2e-3,
            H4=1e-3,
            W3=2e-3,
        )
        test_obj.rotor.winding = WindingCW2LT(qs=3, p=3, Lewout=60e-3)
        plt.close("all")

        test_obj.rotor.plot()
        fig = plt.gcf()
        fig.savefig(join(save_path, "test_Lam_Wind_s60_1-Rotor.png"))
        # 1 for Lam, Zs*2 for wind
        self.assertEqual(len(fig.axes[0].patches), 25)

        test_obj.rotor.slot.W3 = 0
        test_obj.rotor.slot.H3 = 0
        test_obj.rotor.slot.H4 = 0
        test_obj.rotor.plot()
        fig = plt.gcf()
        fig.savefig(join(save_path, "test_Lam_Wind_s60_2-Rotor Wind.png"))
        # 1 for Lam, Zs*2 for wind
        self.assertEqual(len(fig.axes[0].patches), 25)

        tooth = test_obj.rotor.slot.get_surface_tooth()
        tooth.plot(color="r")
        fig = plt.gcf()
        fig.savefig(join(save_path, "test_Lam_Wind_s60_Tooth_in.png"))
示例#4
0
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening

# For AlmostEqual
DELTA = 1e-5

SlotW60_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW60(Zs=12,
                   W1=25e-3,
                   W2=12.5e-3,
                   H1=20e-3,
                   H2=20e-3,
                   R1=0.1,
                   H3=0,
                   H4=0,
                   W3=0)
SlotW60_test.append({
    "test_obj": lam,
    "S_exp": 1.5792e-3,
    "Aw": 0.119451,
    "SW_exp": 2.5e-4,
    "H_exp": 0.0405716,
})

# Internal Slot, R1=Rbo
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW60(