1+ import pytest
2+ from os .path import join
3+
4+ from pyleecan .Functions .load import load
5+ from pyleecan .definitions import DATA_DIR
6+
7+ machine_list = [
8+ ["Toyota_Prius" , (4 , True , 4 , True )],
9+ ["BMW_i3" , (6 , True , 6 , True )],
10+ ["Protean_InWheel" , (8 , False , 32 , True )],
11+ ["Tesla_S" , (2 , False , 2 , False )],
12+ ["Audi_eTron" , (2 , False , 2 , False )],
13+ ["Benchmark" , (1 , True , 5 , True )],
14+ ["SCIM_001" , (1 , True , 1 , True )],
15+ ["SCIM_006" , (2 , True , 2 , True )],
16+ ["SPMSM_001" , (4 , False , 4 , True )],
17+ ["SPMSM_003" , (1 , True , 1 , True )],
18+ ["SPMSM_015" , (9 , False , 9 , True )],
19+ ["SIPMSM_001" , (1 , False , 2 , True )],
20+ ["SynRM_001" , (2 , True , 2 , True )],
21+ ]
22+
23+
24+ @pytest .mark .periodicity
25+ def test_comp_periodicity (machine ):
26+
27+ machine_obj = load (join (DATA_DIR , "Machine" , machine [0 ] + ".json" ))
28+
29+ # per_a, aper_a = machine_obj.comp_periodicity_spatial()
30+
31+ # per_t, aper_t, _, _ = machine_obj.comp_periodicity_time()
32+
33+ per_a , aper_a , per_t , aper_t = machine_obj .comp_periodicity ()
34+
35+ msg = (
36+ "Wrong periodicity calculation for "
37+ + machine_obj .name
38+ + ": "
39+ + str ((per_a , aper_a , per_t , aper_t ))
40+ )
41+ assert (per_a , aper_a , per_t , aper_t ) == machine [1 ], msg
42+
43+ return (per_a , aper_a , per_t , aper_t )
44+
45+
46+ # To run it without pytest
47+ if __name__ == "__main__" :
48+
49+ # per_tuple = test_comp_periodicity(machine_list[1])
50+
51+ for machine in machine_list :
52+ per_tuple = test_comp_periodicity (machine )
0 commit comments