Skip to content

Commit f3b6db8

Browse files
authored
Merge pull request #190 from EOMYS-Public/FEMM
Femm
2 parents c44a4ef + b320b39 commit f3b6db8

File tree

120 files changed

+4039
-71201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+4039
-71201
lines changed

Tests/Methods/Simulation/test_InCurrent_meth.py

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
M1 = MachineDFIM()
6161
M1.stator = LamSlotWind()
6262
M1.stator.winding.qs = 3
63-
M1.rotor.winding = None
63+
M1.rotor.winding.qs = 0
6464
# Winding rotor only
6565
M2 = MachineDFIM()
6666
M2.rotor = LamSlotWind()
6767
M2.rotor.winding.qs = 2
68-
M2.stator.winding = None
68+
M2.stator.winding.qs = 0
6969
# Winding rotor + stator
7070
M3 = MachineDFIM()
7171
M3.stator = LamSlotWind()
@@ -258,11 +258,11 @@ def test_InputCurrent_DQ(self, test_dict):
258258
# Generate Is according to Id/Iq
259259
test_obj.input.gen_input()
260260
assert_array_almost_equal(
261-
output.elec.time.get_values(is_oneperiod=False),
261+
output.elec.Time.get_values(is_oneperiod=False),
262262
time_exp,
263263
)
264264
assert_array_almost_equal(
265-
output.elec.angle.get_values(is_oneperiod=False),
265+
output.elec.Angle.get_values(is_oneperiod=False),
266266
linspace(0, 2 * pi, Na_tot, endpoint=False),
267267
)
268268
assert_array_almost_equal(output.elec.get_Is().values, Is_exp)
@@ -287,7 +287,14 @@ def test_InputCurrent_DQ(self, test_dict):
287287
assert out.elec.Id_ref == pytest.approx(test_dict["Id"], abs=0.01)
288288
assert out.elec.Iq_ref == pytest.approx(test_dict["Iq"], abs=0.01)
289289

290-
out.plot_A_time("elec.Is", index_list=[0, 1, 2])
290+
# Plot 3-phase current function of time
291+
out.plot_2D_Data(
292+
"elec.Is",
293+
"time",
294+
"phase",
295+
)
296+
297+
# Save picture
291298
title = "Id=" + str(test_dict["Id"]) + " Iq=" + str(test_dict["Iq"])
292299
fig = plt.gcf()
293300
plt.title(title)
@@ -302,3 +309,36 @@ def test_InputCurrent_DQ(self, test_dict):
302309
)
303310
)
304311
plt.close("all")
312+
313+
return out
314+
315+
316+
# To run it without pytest
317+
if __name__ == "__main__":
318+
319+
obj = Test_InCurrent_meth()
320+
321+
test_dict = idq_test[0]
322+
323+
out = obj.test_InputCurrent_DQ(test_dict)
324+
325+
# out.plot_2D_Data(
326+
# "elec.Is",
327+
# "time",
328+
# "phase",
329+
# )
330+
331+
# title = "Id=" + str(test_dict["Id"]) + " Iq=" + str(test_dict["Iq"])
332+
# fig = plt.gcf()
333+
# plt.title(title)
334+
# fig.savefig(
335+
# join(
336+
# save_path,
337+
# "test_InCurrent_Id="
338+
# + str(test_dict["Id"])
339+
# + "_Iq="
340+
# + str(test_dict["Iq"])
341+
# + ".png",
342+
# )
343+
# )
344+
# plt.close("all")

Tests/Plot/test_plot_axis.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def test_axis_LamWind(CURVE_COLORS):
219219
fig.savefig(join(save_path, "test_axis_LamWind_mmf.png"))
220220

221221
# Plot maximum of the fundamental of the mmf
222-
MMF = SCIM_001.stator.comp_mmf_unit(Na=600, Nt=1)
222+
MMF = SCIM_001.stator.comp_mmf_unit(Na=600, Nt=1)[0]
223223
p = SCIM_001.stator.get_pole_pair_number()
224224
results = MMF.get_along("angle")
225225
angle_rotor = results["angle"]
@@ -284,9 +284,10 @@ def test_axis_LamWind(CURVE_COLORS):
284284
simu.run()
285285

286286
plt.close("all")
287-
out.plot_A_space("mag.B", is_deg=False)
287+
out.plot_2D_Data("mag.B", "angle{rad}")
288+
288289
fig = plt.gcf()
289-
Br = out.mag.B.get_rad_along("time", "angle")
290+
Br = out.mag.B.components["radial"].get_along("time", "angle")
290291
fig.axes[0].plot(d_angle, max(max(Br)), "rx")
291292
fig.axes[0].text(d_angle, max(max(Br)), "Max of mmf")
292293
fig.savefig(join(save_path, "test_axis_LamWind_flux.png"))

0 commit comments

Comments
 (0)