def __init__(self, lamination=None): """Initialize the widget according to lamination Parameters ---------- self : PCondType11 A PCondType11 widget lamination : Lamination current lamination to edit """ # Build the interface according to the .ui file QWidget.__init__(self) self.setupUi(self) # Set FloatEdit unit self.lf_Wwire.unit = "m" self.lf_Hwire.unit = "m" self.lf_Wins_wire.unit = "m" self.u = gui_option.unit # Set unit name (m ou mm) wid_list = [self.unit_Wwire, self.unit_Hwire, self.unit_Wins_wire] for wid in wid_list: wid.setText(self.u.get_m_name()) # Fill the fields with the machine values (if they're filled) self.lam = lamination self.cond = self.lam.winding.conductor # Make sure that isinstance(cond, CondType11) if self.cond is None or not isinstance(self.cond, CondType11): self.cond = CondType11() self.cond._set_None() if self.cond.Nwppc_tan is None: self.cond.Nwppc_tan = 1 # Default value self.si_Nwpc1_tan.setValue(self.cond.Nwppc_tan) if self.cond.Nwppc_rad is None: self.cond.Nwppc_rad = 1 # Default value self.si_Nwpc1_rad.setValue(self.cond.Nwppc_rad) self.lf_Wwire.setValue(self.cond.Wwire) self.lf_Hwire.setValue(self.cond.Hwire) if self.cond.Wins_wire is None: self.cond.Wins_wire = 0 # Default value self.lf_Wins_wire.setValue(self.cond.Wins_wire) # Display the conductor main output self.w_out.comp_output() # Connect the slot/signal self.si_Nwpc1_tan.editingFinished.connect(self.set_Nwppc_tan) self.si_Nwpc1_rad.editingFinished.connect(self.set_Nwppc_rad) self.lf_Wwire.editingFinished.connect(self.set_Wwire) self.lf_Hwire.editingFinished.connect(self.set_Hwire) self.lf_Wins_wire.editingFinished.connect(self.set_Wins_wire)
def __init__(self, machine, matlib=[], is_stator=False): """Initialize the GUI according to machine Parameters ---------- self : SWindCond A SWindCond 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 # Fill the fields with the machine values (if they're filled) if self.is_stator: self.obj = machine.stator self.w_mat.in_mat_type.setText(self.tr("mat_wind1: ")) else: self.obj = machine.rotor self.w_mat.in_mat_type.setText(self.tr("mat_wind2: ")) self.w_mat.def_mat = "Copper1" # Fill the combobox with the available conductor self.c_cond_type.clear() for cond in name_list: self.c_cond_type.addItem(cond) # Set default conductor if conductor not set if (self.obj.winding.conductor is None or type(self.obj.winding.conductor) not in type_list): # CondType11 is the default self.obj.winding.conductor = CondType11() self.obj.winding.conductor._set_None() # Set the conductor material self.w_mat.update(self.obj.winding.conductor.cond_mat, matlib) # Initialize the needed conductor widget index = type_list.index(type(self.obj.winding.conductor)) self.s_update(index) self.c_cond_type.setCurrentIndex(index) # Connect the widget self.c_cond_type.currentIndexChanged.connect(self.s_set_cond_type) self.w_mat.saveNeeded.connect(self.emit_save)
stator.slot = SlotW22(Zs=12, H0=4e-3, H2=25e-3, W0=0.6 * 12 * pi / 180, W2=12 * pi / 180) stator.winding = WindingDW1L(qs=3, Lewout=15e-3, p=1, Ntcoil=12, Npcpp=1, Nslot_shift_wind=0) stator.winding.conductor = CondType11( Nwppc_tan=1, Nwppc_rad=1, Wwire=2e-3, Hwire=2e-3, Wins_wire=1e-6, type_winding_shape=0, ) # Rotor setup rotor = LamSlotMag(Rext=0.1, Rint=0.0225, L1=0.4, Kf1=0.95, is_internal=True, is_stator=False, Nrvd=0) rotor.slot = SlotMPolar(Zs=2, W3=0, W0=2.82743338823, H0=0) rotor.slot.magnet = [MagnetType11(Wmag=2.82743338823, Hmag=0.012)] shaft = Shaft(Lshaft=0.442, Drsh=45e-3)