Skip to content

Commit 485d8b7

Browse files
committed
[BC] Correcting draw_FEMM
1 parent 5f56787 commit 485d8b7

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

pyleecan/GUI/Dialog/DMachineSetup/SPreview/WMachineTable/WMachineTable.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ......Classes.Simu1 import Simu1
1111
from ......Classes.OPdq import OPdq
1212
from ......Classes.OPslip import OPslip
13+
from ......Classes.InputCurrent import InputCurrent
1314
from ......definitions import config_dict
1415
from ......loggers import GUI_LOG_NAME
1516
from ......Functions.FEMM.update_FEMM_simulation import update_FEMM_simulation
@@ -118,28 +119,28 @@ def draw_FEMM(self):
118119
if save_file_path is [None, ""]:
119120
return
120121

121-
femm = _FEMMHandler()
122-
output = Output(simu=Simu1(machine=self.machine))
123-
# Periodicity
124-
sym, is_antiper = self.machine.comp_periodicity_spatial()
125-
if is_antiper:
126-
sym *= 2
127-
# Set Current (constant J in a layer)
128-
S_slot = self.machine.stator.slot.comp_surface_active()
129-
(Nrad, Ntan) = self.machine.stator.winding.get_dim_wind()
130-
Ntcoil = self.machine.stator.winding.Ntcoil
131-
Sphase = S_slot / (Nrad * Ntan)
132-
J = 5e6
133-
if self.machine.is_synchronous():
134-
op = OPdq(felec=60)
135-
else:
136-
op = OPslip(felec=60)
137-
op.set_Id_Iq(Id=J * Sphase / Ntcoil, Iq=0)
138-
output.simu.input = InputCurrent(OP=op, Nt_tot=20)
139-
output.simu.input.gen_input()
140-
Is = output.elec.get_Is().get_along("phase", "time")["I_s"].transpose()
141-
alpha = output.get_angle_rotor_initial()
142122
try:
123+
femm = _FEMMHandler()
124+
output = Output(simu=Simu1(machine=self.machine))
125+
# Periodicity
126+
sym, is_antiper = self.machine.comp_periodicity_spatial()
127+
if is_antiper:
128+
sym *= 2
129+
# Set Current (constant J in a layer)
130+
S_slot = self.machine.stator.slot.comp_surface_active()
131+
(Nrad, Ntan) = self.machine.stator.winding.get_dim_wind()
132+
Ntcoil = self.machine.stator.winding.Ntcoil
133+
Sphase = S_slot / (Nrad * Ntan)
134+
J = 5e6
135+
if self.machine.is_synchronous():
136+
op = OPdq(felec=60)
137+
else:
138+
op = OPslip(felec=60)
139+
op.set_Id_Iq(Id=J * Sphase / Ntcoil, Iq=0)
140+
output.simu.input = InputCurrent(OP=op, Nt_tot=20)
141+
output.simu.input.gen_input()
142+
Is = output.elec.get_Is().get_along("phase", "time")["I_s"].transpose()
143+
alpha = output.get_angle_rotor_initial()
143144
# Draw the machine
144145
FEMM_dict = draw_FEMM(
145146
femm,
@@ -185,12 +186,12 @@ def draw_GMSH(self):
185186
if save_file_path is [None, ""]:
186187
return
187188
# Create the Simulation
188-
mySimu = Simu1(name="test_gmsh_ipm", machine=self.machine)
189-
myResults = Output(simu=mySimu)
190-
sym, is_antiper = self.machine.comp_periodicity_spatial()
191-
if is_antiper:
192-
sym *= 2
193189
try:
190+
mySimu = Simu1(name="test_gmsh_ipm", machine=self.machine)
191+
myResults = Output(simu=mySimu)
192+
sym, is_antiper = self.machine.comp_periodicity_spatial()
193+
if is_antiper:
194+
sym *= 2
194195
draw_GMSH(
195196
output=myResults,
196197
sym=sym,

0 commit comments

Comments
 (0)