11"""Draw structures inside Onelab."""
22# Python standard libraries
33import numpy as np
4- from logging import Logger
5- from typing import List
4+ import logging
65
76# Local libraries
87from femmt .enumerations import *
98from femmt .data import MeshData
109from femmt .model import Core , WindingWindow , AirGaps , StrayPath , Insulation
1110
11+ logger = logging .getLogger (__name__ )
1212
1313class TwoDaxiSymmetric :
1414 """
@@ -18,28 +18,27 @@ class TwoDaxiSymmetric:
1818 """
1919
2020 core : Core
21- winding_windows : List [WindingWindow ]
21+ winding_windows : list [WindingWindow ]
2222 air_gaps : AirGaps
2323 stray_path : StrayPath
2424 insulation : Insulation
2525 component_type : ComponentType
2626 mesh_data : MeshData
2727 number_of_windings : int
2828 verbosity : Verbosity
29- logger : Logger
3029
3130 # List of points which represent the model
3231 # Every List is a List of 4 Points: x, y, z, mesh_factor
3332 p_outer : np .ndarray
3433 p_region_bound : np .ndarray
3534 p_window : np .ndarray
3635 p_air_gaps : np .ndarray
37- # p_conductor: List[List [float]]
38- p_iso_core : List [ List [float ]]
39- p_iso_pri_sec : List [ List [float ]]
36+ # p_conductor: list[list [float]]
37+ p_iso_core : list [ list [float ]]
38+ p_iso_pri_sec : list [ list [float ]]
4039
41- def __init__ (self , core : Core , mesh_data : MeshData , air_gaps : AirGaps , winding_windows : List [WindingWindow ],
42- stray_path : StrayPath , insulation : Insulation , component_type : ComponentType , number_of_windings : int , verbosity : Verbosity , logger : Logger ):
40+ def __init__ (self , core : Core , mesh_data : MeshData , air_gaps : AirGaps , winding_windows : list [WindingWindow ],
41+ stray_path : StrayPath , insulation : Insulation , component_type : ComponentType , number_of_windings : int , verbosity : Verbosity ):
4342 self .core = core
4443 self .mesh_data = mesh_data
4544 self .winding_windows = winding_windows
@@ -49,7 +48,6 @@ def __init__(self, core: Core, mesh_data: MeshData, air_gaps: AirGaps, winding_w
4948 self .insulation = insulation
5049 self .number_of_windings = number_of_windings
5150 self .verbosity = verbosity
52- self .logger = logger
5351
5452 # -- Arrays for geometry data --
5553 # TODO Is the zero initialization necessary?
@@ -71,16 +69,6 @@ def __init__(self, core: Core, mesh_data: MeshData, air_gaps: AirGaps, winding_w
7169 self .r_inner = core .r_inner
7270 self .r_outer = core .r_outer
7371
74- def femmt_print (self , text : str ):
75- """
76- Print text to terminal or to log-file, dependent on the current verbosity.
77-
78- :param text: text to print
79- :type text: str
80- """
81- if not self .verbosity == Verbosity .Silent :
82- self .logger .info (text )
83-
8472 def draw_outer (self ):
8573 """Draws the outer points of the main core (single core)."""
8674 # Outer Core
@@ -96,7 +84,6 @@ def draw_outer(self):
9684 def draw_single_window (self ):
9785 """Draw a single window."""
9886 # At this point both windows (in a cut) are modeled
99- # print(f"win: c_window: {self.component.mesh.c_window}")
10087 self .p_window [0 ] = [- self .r_inner ,
10188 - self .core .window_h / 2 ,
10289 0 ,
@@ -277,9 +264,6 @@ def draw_conductors(self, draw_top_down: bool = True):
277264 right_bound = virtual_winding_window .right_bound
278265
279266 # Check, if virtual winding window fits in physical window
280- # print(f"{bot_bound = }\n", f"{top_bound = }\n", f"{left_bound = }\n", f"{right_bound = }\n")
281- # print(f"{winding_window.max_bot_bound = }\n", f"{winding_window.max_top_bound = }\n", f"{winding_window.max_left_bound = }\n",
282- # f"{winding_window.max_right_bound = }\n")
283267 if bot_bound < winding_window .max_bot_bound or top_bound > winding_window .max_top_bound or \
284268 left_bound < winding_window .max_left_bound or right_bound > winding_window .max_right_bound :
285269 # Set valid to False, so that geometry is to be neglected in geometry sweep
@@ -309,9 +293,9 @@ def draw_conductors(self, draw_top_down: bool = True):
309293
310294 """
311295 if winding0 .conductor_radius != winding1 .conductor_radius :
312- print ("For bifilar winding scheme both conductors must be of the same radius!" )
296+ logger . warning ("For bifilar winding scheme both conductors must be of the same radius!" )
313297 else :
314- print ("Bifilar winding scheme is applied" )
298+ logger . info ("Bifilar winding scheme is applied" )
315299
316300 raise Exception ("Bifilar winding scheme is not implemented yet." )
317301
@@ -1304,8 +1288,8 @@ def check_number_of_drawn_conductors(self):
13041288 drawn_number_of_turns += int (self .p_conductor [winding .winding_number ].shape [0 ] / 5 ) # rectangular conductors
13051289
13061290 if drawn_number_of_turns != needed_number_of_turns :
1307- self . femmt_print (f"{ drawn_number_of_turns = } " )
1308- self . femmt_print (f"{ needed_number_of_turns = } " )
1291+ logger . info (f"{ drawn_number_of_turns = } " )
1292+ logger . info (f"{ needed_number_of_turns = } " )
13091293 raise Exception ("Winding mismatch. Probably too many turns that do not fit in the winding window" )
13101294
13111295 def draw_region_single (self ):
@@ -1347,7 +1331,7 @@ def draw_insulations(self):
13471331 if self .component_type == ComponentType .IntegratedTransformer :
13481332 # TODO: insulations implement for integrated_transformers
13491333 # TODO Change back to warnings?
1350- self . femmt_print ("Insulations are not set because they are not implemented for integrated transformers." )
1334+ logger . info ("Insulations are not set because they are not implemented for integrated transformers." )
13511335 else :
13521336 window_h = self .core .window_h
13531337 iso = self .insulation
@@ -1587,18 +1571,18 @@ def draw_model(self):
15871571 # self.draw_region_stacked()
15881572
15891573 @staticmethod
1590- def get_center_of_rect (p1 : List [float ], p2 : List [float ], p3 : List [float ], p4 : List [float ]):
1574+ def get_center_of_rect (p1 : list [float ], p2 : list [float ], p3 : list [float ], p4 : list [float ]):
15911575 """
15921576 Get center point of a rectangular conductor.
15931577
15941578 :param p1: Point 1 as a x,y-List
1595- :type p1: List [float]
1579+ :type p1: list [float]
15961580 :param p2: Point 1 as a x,y-List
1597- :type p2: List [float]
1581+ :type p2: list [float]
15981582 :param p3: Point 1 as a x,y-List
1599- :type p3: List [float]
1583+ :type p3: list [float]
16001584 :param p4: Point 1 as a x,y-List
1601- :type p4: List [float]
1585+ :type p4: list [float]
16021586 """
16031587 x_list = [p1 [0 ], p2 [0 ], p3 [0 ], p4 [0 ]]
16041588 y_list = [p1 [1 ], p2 [1 ], p3 [1 ], p4 [1 ]]
0 commit comments