from numpy import pi, ndarray, cos, sin from pyleecan.Classes.LamSlot import LamSlot from ddt import ddt, data from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW22_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=1) lam.slot = SlotW22(Zs=36, W0=pi / 72, W2=pi / 36, H0=6e-3, H2=40e-3) slotW22_test.append({ "test_obj": lam, "S_exp": 3.660915e-03, "SW_exp": 3.3999e-03, "H_exp": 0.046 }) # External Slot lam = LamSlot(is_internal=False, Rint=1) lam.slot = SlotW22(Zs=36, W0=pi / 72, W2=pi / 36, H0=6e-3, H2=40e-3) slotW22_test.append({ "test_obj": lam, "S_exp": 3.844e-03, "SW_exp": 3.5814e-03, "H_exp": 0.046
from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW13_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW13(H0=5e-3, H1=10e-3, H2=30e-3, W0=10e-3, W1=14e-3, W2=8e-3, W3=20e-3, H1_is_rad=False) slotW13_test.append({ "test_obj": lam, "S_exp": 5.906291e-4, "Aw": 0.13671123, "SW_exp": 4.2e-4, "H_exp": 0.04509437, }) # Outward Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW13(H0=5e-3, H1=10e-3,
from numpy import ndarray from pyleecan.Classes.LamSlot import LamSlot from ddt import ddt, data from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW24_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW24(Zs=6, H2=30e-3, W3=12e-3) slotW24_test.append( { "test_obj": lam, "S_exp": 3.33105250485e-3, "Ao": 0.9566, "Aw": 0.94497, "SW_exp": 3.33105e-3, "H_exp": 0.03, } ) # External Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW24(Zs=6, H2=30e-3, W3=12e-3) slotW24_test.append(
from numpy import ndarray from pyleecan.Classes.LamSlot import LamSlot from ddt import ddt, data from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW25_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW25(Zs=10, H1=3e-3, H2=30e-3, W3=20e-3, W4=40e-3) slotW25_test.append( { "test_obj": lam, "S_exp": 0.001678213, "Ao": 0.32527, "Aw": 0.45157, "SW_exp": 0.0015532047, "H_exp": 0.032848, } ) # External Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW25(Zs=10, H1=3e-3, H2=30e-3, W3=20e-3, W4=40e-3) slotW25_test.append(
from numpy import ndarray from pyleecan.Classes.LamSlot import LamSlot from ddt import ddt, data from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW26_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1) lam.slot = SlotW26(Zs=12, H0=10e-3, W0=10e-3, H1=0.025, R1=0.01, R2=0.0075) slotW26_test.append({ "test_obj": lam, "S_exp": 7.7471e-4, "Ao": 0.10004, "Aw": 0.2362668, "SW_exp": 6.7387e-4, "H_exp": 5.1285e-2, }) # External Slot lam = LamSlot(is_internal=False, Rint=0.1) lam.slot = SlotW26(Zs=12, H0=10e-3, W0=10e-3, H1=0.025, R1=0.01, R2=0.0075) slotW26_test.append({ "test_obj": lam, "S_exp": 7.73044e-4,
from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 SlotW15_test = list() # Outward Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW15(H0=5e-3, H1=5e-3, H2=20e-3, R1=4.5e-3, R2=4e-3, W0=5e-3, W3=10e-3) SlotW15_test.append({ "test_obj": lam, "S_exp": 4.1010919e-4, "Aw": 0.10268530, "SW_exp": 3.8506988e-4, "H_exp": 0.03, }) @ddt class test_SlotW15_meth(TestCase): """unittest for SlotW15 methods"""
from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-6 slotW10_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW10(H0=1e-3, H1=1.5e-3, H2=30e-3, W0=12e-3, W1=14e-3, W2=12e-3, H1_is_rad=False) slotW10_test.append({ "test_obj": lam, "S_exp": 3.9258746e-4, "Aw": 0.1044713, "SW_exp": 3.6e-4, "H_exp": 3.263591e-2, }) # Outward Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW10(H0=1e-3, H1=1.5e-3,
from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW21_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1) lam.slot = SlotW21(Zs=36, H0=3e-3, H1=0, H1_is_rad=False, H2=20e-3, W0=3e-3, W1=13e-3, W2=10e-3) slotW21_test.append({ "test_obj": lam, "S_exp": 2.390225015189331e-4, "Aw": 0.132201, "SW_exp": 2.3e-4, "H_exp": 2.3011250632883697e-2, }) # External Slot lam = LamSlot(is_internal=False, Rint=0.1) lam.slot = SlotW21(Zs=36, H0=3e-3,
from pyleecan.Classes.Arc1 import Arc1 from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-6 slotW11_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW11(H0=1e-3, H1=1.5e-3, H2=30e-3, W0=12e-3, W1=14e-3, W2=12e-3, R1=5e-3) slotW11_test.append({ "test_obj": lam, "S_exp": 4.06857e-4, "Aw": 0.1086124, "SW_exp": 3.7427e-4, "H_exp": 3.263591e-2, }) # Outward Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW11(H0=1e-3, H1=1.5e-3,
from pyleecan.Classes.SurfLine import SurfLine from pyleecan.Classes.Arc1 import Arc1 from pyleecan.Classes.Arc3 import Arc3 from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW12_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW12(H0=1e-3, H1=6e-3, R1=0.5e-3, R2=2e-3) slotW12_test.append( { "test_obj": lam, "S_exp": 3.91088e-5, "Aw": 0.0299276, "SW_exp": 3.028318e-5, "H_exp": 1.0015e-2, } ) # Outward Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW12(H0=1e-3, H1=6e-3, R1=0.5e-3, R2=2e-3) slotW12_test.append( {
from pyleecan.Classes.SlotW14 import SlotW14 from numpy import ndarray, arcsin from pyleecan.Classes.LamSlot import LamSlot from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 SlotW14_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW14(H0=5e-3, H1=5e-3, H3=25e-3, W0=5e-3, W3=10e-3) SlotW14_test.append({ "test_obj": lam, "S_exp": 2.9443933e-4, "Aw": 0.08445503, "SW_exp": 2.28378e-4, "H_exp": 0.03486507, }) # Outward Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW14(H0=5e-3, H1=5e-3, H3=25e-3, W0=5e-3, W3=10e-3) SlotW14_test.append({ "test_obj": lam, "S_exp": 5.0790294e-4, "Aw": 0.108324,
from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening # For AlmostEqual DELTA = 1e-5 SlotW60_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW60(Zs=12, W1=25e-3, W2=12.5e-3, H1=20e-3, H2=20e-3, R1=0.1, H3=0, H4=0, W3=0) SlotW60_test.append({ "test_obj": lam, "S_exp": 1.5792e-3, "Aw": 0.119451, "SW_exp": 2.5e-4, "H_exp": 0.0405716, }) # Internal Slot, R1=Rbo lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW60(
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening # For AlmostEqual DELTA = 1e-5 SlotW61_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW61( Zs=12, W0=15e-3, W1=40e-3, W2=12.5e-3, H0=15e-3, H1=20e-3, H2=25e-3, H3=0, H4=0, W3=0, ) SlotW61_test.append({ "test_obj": lam, "S_exp": 1.69308e-3, "Aw": 0.29889, "SW_exp": 6.875e-4, "H_exp": 5.9942749e-2, "Ao": 0.41033, }) # Internal Slot small wind
from pyleecan.Classes.Segment import Segment from ddt import ddt, data from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW27_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1) lam.slot = SlotW27( Zs=12, H0=10e-3, W0=10e-3, H1=0.03, W1=0.02, H2=0.02, W2=0.03, W3=0.02 ) slotW27_test.append( { "test_obj": lam, "S_exp": 1.3508e-3, "Ao": 0.10004, "Aw": 0.3853569, "SW_exp": 1.25e-3, "H_exp": 6.0125e-2, } ) # External Slot lam = LamSlot(is_internal=False, Rint=0.1) lam.slot = SlotW27(
from numpy import ndarray, arcsin, exp from pyleecan.Classes.LamSlot import LamSlot from ddt import ddt, data from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW29_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW29(H0=1e-3, H1=1.5e-3, H2=30e-3, W0=12e-3, W1=14e-3, W2=20e-3) slotW29_test.append({ "test_obj": lam, "S_exp": 6.340874e-4, "Ao": 0.10004, "Aw": 0.174118, "SW_exp": 6e-4, "H_exp": 3.26359e-2, }) # External Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW29(H0=1e-3, H1=1.5e-3, H2=30e-3, W0=12e-3, W1=14e-3, W2=20e-3) slotW29_test.append({ "test_obj": lam, "S_exp": 6.31912e-4,
from pyleecan.Classes.SlotW16 import SlotW16 from numpy import ndarray, arcsin, pi from pyleecan.Classes.LamSlot import LamSlot from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 SlotW16_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW16(Zs=8, H0=5e-3, H2=30e-3, R1=5e-3, W0=pi / 12, W3=10e-3) SlotW16_test.append({ "test_obj": lam, "S_exp": 2.508259e-3, "Aw": 0.6927673, "SW_exp": 2.33808e-3, "H_exp": 3.5e-2, }) @ddt class test_SlotW16_meth(TestCase): """unittest for SlotW16 methods""" @data(*SlotW16_test) def test_comp_surface(self, test_dict): """Check that the computation of the surface is correct
def test_build_geometry(self): """check that curve_list is correct""" test_obj = LamSlot(is_internal=False, Rint=1) test_obj.slot = SlotW29(W0=0.2, H0=0.1, W1=0.4, H1=0.1, H2=0.6, W2=0.6) # Rbo=1 Z1 = exp(1j * float(arcsin(0.1))) Z2 = Z1 + 0.1 Z3 = Z1 + 0.1 + 0.1j Z4 = Z1 + 0.2 + 0.1j Z5 = Z1 + 0.2 + 0.2j Z6 = Z1 + 0.8 + 0.2j Z7 = Z1 + 0.8 - 0.4j Z8 = Z1 + 0.2 - 0.4j Z9 = Z1 + 0.2 - 0.3j Z10 = Z1 + 0.1 - 0.3j Z11 = Z1 + 0.1 - 0.2j Z12 = Z1 - 0.2j [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, Z10, Z11, Z12] = [ Z12, Z11, Z10, Z9, Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1, ] # Creation of curve curve_list = list() curve_list.append(Segment(Z1, Z2)) curve_list.append(Segment(Z2, Z3)) curve_list.append(Segment(Z3, Z4)) curve_list.append(Segment(Z4, Z5)) curve_list.append(Segment(Z5, Z6)) curve_list.append(Segment(Z6, Z7)) curve_list.append(Segment(Z7, Z8)) curve_list.append(Segment(Z8, Z9)) curve_list.append(Segment(Z9, Z10)) curve_list.append(Segment(Z10, Z11)) curve_list.append(Segment(Z11, Z12)) result = test_obj.slot.build_geometry() self.assertEqual(len(result), len(curve_list)) for i in range(0, len(result)): a = result[i].begin b = curve_list[i].begin self.assertAlmostEqual( (a - b) / a, 0, delta=DELTA, msg="Wrong build_geo (for begin point " + str(i) + " returned " + str(a) + ", expected " + str(b) + ")", ) a = result[i].end b = curve_list[i].end self.assertAlmostEqual( (a - b) / a, 0, delta=DELTA, msg="Wrong build_geo (for end point " + str(i) + " returned " + str(a) + ", expected " + str(b) + ")", )
from numpy import ndarray from pyleecan.Classes.LamSlot import LamSlot from ddt import ddt, data from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW26_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1) lam.slot = SlotW26(Zs=12, H0=10e-3, W0=10e-3, H1=0.025, R1=0.01) slotW26_test.append( { "test_obj": lam, "S_exp": 9.059346e-4, "Ao": 0.10004, "Aw": 0.271, "SW_exp": 8.05100657e-4, "H_exp": 5.3785e-2, } ) # External Slot lam = LamSlot(is_internal=False, Rint=0.1) lam.slot = SlotW26(Zs=12, H0=10e-3, W0=10e-3, H1=0.025, R1=0.01) slotW26_test.append(
from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW23_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW23(H0=1e-3, H1=1.5e-3, H1_is_rad=False, H2=30e-3, W0=12e-3, W1=14e-3, W2=12e-3) slotW23_test.append({ "test_obj": lam, "S_exp": 4.2080459e-4, "Aw": 0.112537, "SW_exp": 3.8834260e-04, "H_exp": 0.032438, }) # External Slot lam = LamSlot(is_internal=False, Rint=0.1325) lam.slot = SlotW23(H0=1e-3, H1=1.5e-3,
from pyleecan.Classes.LamSlot import LamSlot from pyleecan.Classes.Segment import Segment from ddt import ddt, data from pyleecan.Methods.Slot.Slot.comp_height import comp_height from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind # For AlmostEqual DELTA = 1e-4 slotW28_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=84e-3) lam.slot = SlotW28(Zs=42, W0=3.5e-3, H0=0.45e-3, R1=3.5e-3, H3=14e-3, W3=5e-3) slotW28_test.append({ "test_obj": lam, "S_exp": 1.1448e-4, "Ao": 0.0416696, "Aw": 0.107065, "SW_exp": 1.12862e-4, "H_exp": 2.0189e-2, }) # External Slot lam = LamSlot(is_internal=False, Rint=85e-3) lam.slot = SlotW28(Zs=18, W0=7e-3, R1=10e-3, H0=5e-3, H3=30e-3, W3=5e-3) slotW28_test.append({ "test_obj": lam, "S_exp": 1.8896e-3,