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

        Parameters
        ----------
        self : PCondType21
            A PCondType21 widget
        machine : Machine
            current machine to edit
        matlib : list
            List of available Material
        """
        # Build the interface according to the .ui file
        QWidget.__init__(self)
        self.setupUi(self)

        # Setup material combobox according to matlib names
        self.matlib = matlib
        self.w_mat.def_mat = "Copper1"

        # Set FloatEdit unit
        self.lf_Hbar.unit = "m"
        self.lf_Wbar.unit = "m"

        # Set unit name (m ou mm)
        self.u = gui_option.unit
        wid_list = [self.unit_Hbar, self.unit_Wbar]
        for wid in wid_list:
            wid.setText(self.u.get_m_name())

        # Fill the fields with the machine values (if they're filled)
        self.machine = machine

        conductor = machine.rotor.winding.conductor
        # Make sure that the rotor's conductor is a 2_1
        if conductor is None or not isinstance(conductor, CondType21):
            self.machine.rotor.winding.conductor = CondType21()
            self.machine.rotor.winding.conductor._set_None()

        self.lf_Hbar.setValue(conductor.Hbar)
        self.lf_Wbar.setValue(conductor.Wbar)

        self.w_mat.update(self.machine.rotor.winding.conductor.cond_mat,
                          matlib)

        # Display the main output
        self.w_out.comp_output()

        # Connect the widget
        self.lf_Hbar.editingFinished.connect(self.set_Hbar)
        self.lf_Wbar.editingFinished.connect(self.set_Wbar)
        self.w_mat.saveNeeded.connect(self.emit_save)
示例#2
0
    def setUp(self):
        """Run at the begining of every test to setup the gui"""
        self.test_obj = MachineSCIM()
        self.test_obj.rotor = LamSquirrelCage(Hscr=0.11, Lscr=0.12)
        self.test_obj.rotor.slot = SlotW22(H0=0.001, H2=0.01, W0=0.1, W2=0.2)
        self.test_obj.rotor.winding.Lewout = 0.13
        self.test_obj.rotor.ring_mat.name = "test3"
        self.test_obj.rotor.winding.conductor = CondType21(Hbar=0.014,
                                                           Wbar=0.015)
        self.test_obj.rotor.winding.conductor.cond_mat.name = "test1"

        self.matlib = list()
        self.matlib.append(Material(name="test1"))
        self.matlib[-1].elec.rho = 0.31
        self.matlib.append(Material(name="test2"))
        self.matlib[-1].elec.rho = 0.32
        self.matlib.append(Material(name="test3"))
        self.matlib[-1].elec.rho = 0.33

        self.widget = SBar(machine=self.test_obj,
                           matlib=self.matlib,
                           is_stator=False)
示例#3
0
    is_internal=True,
    is_stator=False,
    Hscr=20e-3,
    Lscr=15e-3,
    Nrvd=0,
)
rotor.axial_vent = [VentilationCirc(Zh=8, D0=20e-3, H0=70e-3, Alpha0=0)]

rotor.slot = SlotW21(Zs=28,
                     H0=3e-3,
                     W0=3e-3,
                     H1=0,
                     H2=20e-3,
                     W1=13e-3,
                     W2=10e-3)
rotor.winding = WindingSC(Ntcoil=1, qs=28, Lewout=17e-3, Npcpp=1)
rotor.winding.conductor = CondType21(Hbar=0.02, Wbar=0.01, Wins=0)

shaft = Shaft(Drsh=90e-3)

frame = None

# Set materials
stator.mat_type = M400_50A
stator.winding.conductor.cond_mat = Copper1
rotor.mat_type = M400_50A
rotor.ring_mat = Copper1
rotor.winding.conductor.cond_mat = Copper1

SCIM_001 = MachineSCIM(stator=stator, rotor=rotor, shaft=shaft, frame=frame)