Source code for pyleecan.Tests.Plot.LamHole.test_Hole_54_plot

# -*- coding: utf-8 -*-

from os.path import join
import matplotlib.pyplot as plt
from numpy import pi

from ....Classes.Frame import Frame
from ....Classes.LamHole import LamHole
from ....Classes.LamSlotWind import LamSlotWind
from ....Classes.MachineIPMSM import MachineIPMSM
from ....Classes.Magnet import Magnet
from ....Classes.Shaft import Shaft
from ....Classes.HoleM54 import HoleM54
from ....Tests import save_plot_path as save_path


"""unittest for Lamination with Hole plot"""


[docs]def test_Lam_Hole_54_plot(): """Test machine plot hole 54""" plt.close("all") test_obj = MachineIPMSM() test_obj.rotor = LamHole( is_internal=True, Rint=0.1, Rext=0.2, is_stator=False, L1=0.7 ) test_obj.rotor.hole = list() test_obj.rotor.hole.append(HoleM54(Zh=8, W0=pi / 4, H0=50e-3, H1=10e-3, R1=100e-3)) test_obj.rotor.hole.append(HoleM54(Zh=8, W0=pi / 6, H0=25e-3, H1=10e-3, R1=100e-3)) test_obj.rotor.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Hole_s54-Rotor.png")) assert len(fig.axes[0].patches) == 18 test_obj.rotor.hole[0].plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Hole_s54-Rotor hole.png")) assert len(fig.axes[0].patches) == 1