diff --git a/femmt/component.py b/femmt/component.py index b0579cd4..5428f05b 100644 --- a/femmt/component.py +++ b/femmt/component.py @@ -453,7 +453,7 @@ def set_insulation(self, insulation: Insulation): :type insulation: Insulation """ # For integrated transformers, check if top and bottom core insulations are set - if self.component_type == ComponentType.IntegratedTransformer and self.stray_path: + if self.component_type == ComponentType.IntegratedTransformer: if (insulation.top_section_core_cond is None or not insulation.top_section_core_cond) and ( insulation.bot_section_core_cond is None or not insulation.bot_section_core_cond): raise Exception("Insulations for the top and bottom core sections must be set for integrated transformers") diff --git a/femmt/drawing.py b/femmt/drawing.py index 08358c91..f91002a7 100644 --- a/femmt/drawing.py +++ b/femmt/drawing.py @@ -1349,31 +1349,35 @@ def draw_insulations(self): return # if flag_insulation is False, just return without drawing insulations if self.component_type == ComponentType.IntegratedTransformer: - if not self.stray_path: + # if not self.stray_path: + # + # # TODO: insulations implement for integrated_transformers + # # TODO Change back to warnings? + # self.femmt_print("Insulations are not set because they are not implemented for integrated transformers.") + # else: + iso = self.insulation + mesh_data = self.mesh_data + # Since there are many cases in which alternating conductors would lead to slightly different + # mesh densities a simplification is made: Just use the lowest mesh density to be safe all the time. + mesh_density_to_winding = min(mesh_data.c_conductor) - # TODO: insulations implement for integrated_transformers - # TODO Change back to warnings? - self.femmt_print("Insulations are not set because they are not implemented for integrated transformers.") + mesh_density_to_core = mesh_data.c_window + if self.insulation.max_aspect_ratio == 0: + # If no aspect ratio is set insulations will not be drawn + return else: - window_h = self.core.window_h - iso = self.insulation - mesh_data = self.mesh_data - # Since there are many cases in which alternating conductors would lead to slightly different - # mesh densities a simplification is made: Just use the lowest mesh density to be safe all the time. - mesh_density_to_winding = min(mesh_data.c_conductor) - - mesh_density_to_core = mesh_data.c_window - if self.insulation.max_aspect_ratio == 0: - # If no aspect ratio is set insulations will not be drawn - return - else: - insulation_delta = self.mesh_data.c_window / self.insulation.max_aspect_ratio + insulation_delta = self.mesh_data.c_window / self.insulation.max_aspect_ratio - # self.p_iso_core = [] # Order: Left, Top, Right, Bot - self.p_iso_top_core = [] - self.p_iso_bot_core = [] - self.p_iso_pri_sec = [] + # self.p_iso_core = [] # Order: Left, Top, Right, Bot + self.p_iso_top_core = [] + self.p_iso_bot_core = [] + self.p_iso_pri_sec = [] + # Useful points for insulation creation + left_x = self.core.core_inner_diameter / 2 + insulation_delta + right_x = self.r_inner - insulation_delta + if self.stray_path: # Useful dimensions needed for calculating some points + window_h = self.core.window_h start_index = self.stray_path.start_index air_gap_1_position = self.air_gaps.midpoints[start_index][1] air_gap_1_height = self.air_gaps.midpoints[start_index][2] @@ -1381,240 +1385,243 @@ def draw_insulations(self): air_gap_2_height = self.air_gaps.midpoints[start_index + 1][2] y_top_stray_path = air_gap_2_position - (air_gap_2_height / 2) y_bot_stray_path = air_gap_1_position + (air_gap_1_height / 2) - - # Useful points for insulation creation - left_x = self.core.core_inner_diameter / 2 + insulation_delta - right_x = self.r_inner - insulation_delta top_section_top_y = window_h / 2 - insulation_delta - top_section_bot_y = y_top_stray_path - bot_section_top_y = y_bot_stray_path + top_section_bot_y = y_top_stray_path - insulation_delta + bot_section_top_y = y_bot_stray_path - insulation_delta bot_section_bot_y = -window_h / 2 + insulation_delta + else: + window_h_top = self.core.window_h_top + window_h_bot = self.core.window_h_bot + top_section_top_y = window_h_bot / 2 + self.core.core_thickness + window_h_top - insulation_delta + top_section_bot_y = window_h_bot / 2 + self.core.core_thickness + insulation_delta + bot_section_top_y = window_h_bot / 2 + insulation_delta + bot_section_bot_y = -window_h_bot / 2 + insulation_delta + + # Useful lengths + # top core + top_section_left_iso_width = iso.top_section_core_cond[2] - insulation_delta - insulation_delta + top_section_top_iso_height = iso.top_section_core_cond[0] - insulation_delta - insulation_delta + top_section_right_iso_width = iso.top_section_core_cond[3] - insulation_delta - insulation_delta + top_section_bot_iso_height = iso.top_section_core_cond[1] - insulation_delta - insulation_delta + # bot core + bot_section_left_iso_width = iso.bot_section_core_cond[2] - insulation_delta - insulation_delta + bot_section_top_iso_height = iso.bot_section_core_cond[0] - insulation_delta - insulation_delta + bot_section_right_iso_width = iso.bot_section_core_cond[3] - insulation_delta - insulation_delta + bot_section_bot_iso_height = iso.bot_section_core_cond[1] - insulation_delta - insulation_delta - # Useful lengths - # top core - top_section_left_iso_width = iso.top_section_core_cond[2] - insulation_delta - insulation_delta - top_section_top_iso_height = iso.top_section_core_cond[0] - insulation_delta - insulation_delta - top_section_right_iso_width = iso.top_section_core_cond[3] - insulation_delta - insulation_delta - top_section_bot_iso_height = iso.top_section_core_cond[1] - insulation_delta - insulation_delta - # bot core - bot_section_left_iso_width = iso.bot_section_core_cond[2] - insulation_delta - insulation_delta - bot_section_top_iso_height = iso.bot_section_core_cond[0] - insulation_delta - insulation_delta - bot_section_right_iso_width = iso.bot_section_core_cond[3] - insulation_delta - insulation_delta - bot_section_bot_iso_height = iso.bot_section_core_cond[1] - insulation_delta - insulation_delta - - # Core to Pri insulation - # top core points - iso_top_core_left = [ - [ - left_x, - top_section_top_y - top_section_top_iso_height - insulation_delta, - 0, - mesh_density_to_core - ], - [ - left_x + top_section_left_iso_width, - top_section_top_y - top_section_top_iso_height - insulation_delta, - 0, - mesh_density_to_winding - ], - [ - left_x + top_section_left_iso_width, - top_section_bot_y + top_section_bot_iso_height + insulation_delta, - 0, - mesh_density_to_winding - ], - [ - left_x, - top_section_bot_y + top_section_bot_iso_height + insulation_delta, - 0, - mesh_density_to_core - ] + # Core to Pri insulation + # top core points + iso_top_core_left = [ + [ + left_x, + top_section_top_y - top_section_top_iso_height - insulation_delta, + 0, + mesh_density_to_core + ], + [ + left_x + top_section_left_iso_width, + top_section_top_y - top_section_top_iso_height - insulation_delta, + 0, + mesh_density_to_winding + ], + [ + left_x + top_section_left_iso_width, + top_section_bot_y + top_section_bot_iso_height + insulation_delta, + 0, + mesh_density_to_winding + ], + [ + left_x, + top_section_bot_y + top_section_bot_iso_height + insulation_delta, + 0, + mesh_density_to_core ] - iso_top_core_top = [ - [ - left_x, - top_section_top_y, - 0, - mesh_density_to_core - ], - [ - right_x, - top_section_top_y, - 0, - mesh_density_to_core - ], - [ - right_x, - top_section_top_y - top_section_top_iso_height, - 0, - mesh_density_to_winding - ], - [ - left_x, - top_section_top_y - top_section_top_iso_height, - 0, - mesh_density_to_winding - ] + ] + iso_top_core_top = [ + [ + left_x, + top_section_top_y, + 0, + mesh_density_to_core + ], + [ + right_x, + top_section_top_y, + 0, + mesh_density_to_core + ], + [ + right_x, + top_section_top_y - top_section_top_iso_height, + 0, + mesh_density_to_winding + ], + [ + left_x, + top_section_top_y - top_section_top_iso_height, + 0, + mesh_density_to_winding ] - iso_top_core_right = [ - [ - right_x - top_section_right_iso_width, - top_section_top_y - top_section_top_iso_height - insulation_delta, - 0, - mesh_density_to_winding - ], - [ - right_x, - top_section_top_y - top_section_top_iso_height - insulation_delta, - 0, - mesh_density_to_core - ], - [ - right_x, - top_section_bot_y + top_section_bot_iso_height + insulation_delta, - 0, - mesh_density_to_core - ], - [ - right_x - top_section_right_iso_width, - top_section_bot_y + top_section_bot_iso_height + insulation_delta, - 0, - mesh_density_to_winding - ] + ] + iso_top_core_right = [ + [ + right_x - top_section_right_iso_width, + top_section_top_y - top_section_top_iso_height - insulation_delta, + 0, + mesh_density_to_winding + ], + [ + right_x, + top_section_top_y - top_section_top_iso_height - insulation_delta, + 0, + mesh_density_to_core + ], + [ + right_x, + top_section_bot_y + top_section_bot_iso_height + insulation_delta, + 0, + mesh_density_to_core + ], + [ + right_x - top_section_right_iso_width, + top_section_bot_y + top_section_bot_iso_height + insulation_delta, + 0, + mesh_density_to_winding ] - iso_top_core_bot = [ - [ - left_x, - top_section_bot_y + top_section_bot_iso_height, - 0, - mesh_density_to_winding - ], - [ - right_x, - top_section_bot_y + top_section_bot_iso_height, - 0, - mesh_density_to_winding - ], - [ - right_x, - top_section_bot_y, - 0, - mesh_density_to_core - ], - [ - left_x, - top_section_bot_y, - 0, - mesh_density_to_core - ] + ] + iso_top_core_bot = [ + [ + left_x, + top_section_bot_y + top_section_bot_iso_height, + 0, + mesh_density_to_winding + ], + [ + right_x, + top_section_bot_y + top_section_bot_iso_height, + 0, + mesh_density_to_winding + ], + [ + right_x, + top_section_bot_y, + 0, + mesh_density_to_core + ], + [ + left_x, + top_section_bot_y, + 0, + mesh_density_to_core ] - # bot core points - iso_bot_core_left = [ - [ - left_x, - bot_section_top_y - bot_section_top_iso_height - insulation_delta, - 0, - mesh_density_to_core - ], - [ - left_x + bot_section_left_iso_width, - bot_section_top_y - bot_section_top_iso_height - insulation_delta, - 0, - mesh_density_to_winding - ], - [ - left_x + bot_section_left_iso_width, - bot_section_bot_y + bot_section_bot_iso_height + insulation_delta, - 0, - mesh_density_to_winding - ], - [ - left_x, - bot_section_bot_y + bot_section_bot_iso_height + insulation_delta, - 0, - mesh_density_to_core - ] + ] + # bot core points + iso_bot_core_left = [ + [ + left_x, + bot_section_top_y - bot_section_top_iso_height - insulation_delta, + 0, + mesh_density_to_core + ], + [ + left_x + bot_section_left_iso_width, + bot_section_top_y - bot_section_top_iso_height - insulation_delta, + 0, + mesh_density_to_winding + ], + [ + left_x + bot_section_left_iso_width, + bot_section_bot_y + bot_section_bot_iso_height + insulation_delta, + 0, + mesh_density_to_winding + ], + [ + left_x, + bot_section_bot_y + bot_section_bot_iso_height + insulation_delta, + 0, + mesh_density_to_core ] - iso_bot_core_top = [ - [ - left_x, - bot_section_top_y, - 0, - mesh_density_to_core - ], - [ - right_x, - bot_section_top_y, - 0, - mesh_density_to_core - ], - [ - right_x, - bot_section_top_y - bot_section_top_iso_height, - 0, - mesh_density_to_winding - ], - [ - left_x, - bot_section_top_y - bot_section_top_iso_height, - 0, - mesh_density_to_winding - ] + ] + iso_bot_core_top = [ + [ + left_x, + bot_section_top_y, + 0, + mesh_density_to_core + ], + [ + right_x, + bot_section_top_y, + 0, + mesh_density_to_core + ], + [ + right_x, + bot_section_top_y - bot_section_top_iso_height, + 0, + mesh_density_to_winding + ], + [ + left_x, + bot_section_top_y - bot_section_top_iso_height, + 0, + mesh_density_to_winding ] - iso_bot_core_right = [ - [ - right_x - bot_section_right_iso_width, - bot_section_top_y - bot_section_top_iso_height - insulation_delta, - 0, - mesh_density_to_winding - ], - [ - right_x, - bot_section_top_y - bot_section_top_iso_height - insulation_delta, - 0, - mesh_density_to_core - ], - [ - right_x, - bot_section_bot_y + bot_section_bot_iso_height + insulation_delta, - 0, - mesh_density_to_core - ], - [ - right_x - bot_section_right_iso_width, - bot_section_bot_y + bot_section_bot_iso_height + insulation_delta, - 0, - mesh_density_to_winding - ] + ] + iso_bot_core_right = [ + [ + right_x - bot_section_right_iso_width, + bot_section_top_y - bot_section_top_iso_height - insulation_delta, + 0, + mesh_density_to_winding + ], + [ + right_x, + bot_section_top_y - bot_section_top_iso_height - insulation_delta, + 0, + mesh_density_to_core + ], + [ + right_x, + bot_section_bot_y + bot_section_bot_iso_height + insulation_delta, + 0, + mesh_density_to_core + ], + [ + right_x - bot_section_right_iso_width, + bot_section_bot_y + bot_section_bot_iso_height + insulation_delta, + 0, + mesh_density_to_winding ] - iso_bot_core_bot = [ - [ - left_x, - bot_section_bot_y + bot_section_bot_iso_height, - 0, - mesh_density_to_winding - ], - [ - right_x, - bot_section_bot_y + bot_section_bot_iso_height, - 0, - mesh_density_to_winding - ], - [ - right_x, - bot_section_bot_y, - 0, - mesh_density_to_core - ], - [ - left_x, - bot_section_bot_y, - 0, - mesh_density_to_core - ] + ] + iso_bot_core_bot = [ + [ + left_x, + bot_section_bot_y + bot_section_bot_iso_height, + 0, + mesh_density_to_winding + ], + [ + right_x, + bot_section_bot_y + bot_section_bot_iso_height, + 0, + mesh_density_to_winding + ], + [ + right_x, + bot_section_bot_y, + 0, + mesh_density_to_core + ], + [ + left_x, + bot_section_bot_y, + 0, + mesh_density_to_core ] - self.p_iso_top_core = [iso_top_core_left, iso_top_core_top, iso_top_core_right, iso_top_core_bot] - self.p_iso_bot_core = [iso_bot_core_left, iso_bot_core_top, iso_bot_core_right, iso_bot_core_bot] + ] + self.p_iso_top_core = [iso_top_core_left, iso_top_core_top, iso_top_core_right, iso_top_core_bot] + self.p_iso_bot_core = [iso_bot_core_left, iso_bot_core_top, iso_bot_core_right, iso_bot_core_bot] else: window_h = self.core.window_h diff --git a/femmt/examples/basic_transformer_center_tapped.py b/femmt/examples/basic_transformer_center_tapped.py index d7c026e3..763da884 100644 --- a/femmt/examples/basic_transformer_center_tapped.py +++ b/femmt/examples/basic_transformer_center_tapped.py @@ -145,7 +145,7 @@ def example_thermal_simulation(show_thermal_visual_outputs: bool = True, flag_in geo.create_model(freq=200000, pre_visualize_geometry=show_visual_outputs) geo.single_simulation(freq=200000, current=[20, 120, 120], phi_deg=[0, 180, 180], show_fem_simulation_results=show_visual_outputs) - example_thermal_simulation(show_visual_outputs, flag_insulation=False) + example_thermal_simulation(show_visual_outputs, flag_insulation=True) if __name__ == "__main__": diff --git a/femmt/examples/basic_transformer_stacked.py b/femmt/examples/basic_transformer_stacked.py index cb8215ab..21113824 100644 --- a/femmt/examples/basic_transformer_stacked.py +++ b/femmt/examples/basic_transformer_stacked.py @@ -121,9 +121,11 @@ def example_thermal_simulation(show_thermal_visual_outputs: bool = True, flag_in geo.set_air_gaps(air_gaps) # 4. set insulations - insulation = fmt.Insulation(flag_insulation=False) - insulation.add_core_insulations(0.001, 0.001, 0.001, 0.001) # [bot, top, left, right] - insulation.add_winding_insulations([[0.0002, 0.001], + insulation = fmt.Insulation(flag_insulation=True) + # insulation.add_core_insulations(0.001, 0.001, 0.001, 0.001) # [bot, top, left, right] + insulation.add_top_section_core_insulations(0.001, 0.001, 0.001, 0.001) + insulation.add_bottom_section_core_insulations(0.001, 0.001, 0.001, 0.001) + insulation.add_winding_insulations([[0.0001, 0.001], [0.001, 0.0002]]) geo.set_insulation(insulation) diff --git a/femmt/functions_topologies.py b/femmt/functions_topologies.py index 3276c693..54114047 100644 --- a/femmt/functions_topologies.py +++ b/femmt/functions_topologies.py @@ -29,7 +29,11 @@ def create_stacked_winding_windows(core: Core, insulation: Insulation) -> (Windi min_pos = core.window_h_bot / 2 distance = max_pos - min_pos horizontal_split = min_pos + distance / 2 - insulation.vww_insulations = distance + 2 * min(insulation.core_cond) # TODO: enhance the insulations situation!!! + if insulation.top_section_core_cond: + insulation_top = min(insulation.top_section_core_cond) + if insulation.bot_section_core_cond: + insulation_bot = min(insulation.bot_section_core_cond) + insulation.vww_insulations = distance + 2 * min(insulation_top, insulation_bot) winding_window_top.max_bot_bound = horizontal_split + insulation.vww_insulations / 2 winding_window_top.max_top_bound = winding_window_top.max_top_bound @@ -272,8 +276,12 @@ def set_center_tapped_windings(core: Core, :type foil_horizontal_placing_strategy: FoilHorizontalDistribution """ def define_insulations(): - insulation = Insulation(flag_insulation=False) - insulation.add_core_insulations(iso_top_core, iso_bot_core, iso_left_core, iso_right_core) + insulation = Insulation(flag_insulation=True) + if core.core_type == CoreType.Single: + insulation.add_core_insulations(iso_top_core, iso_bot_core, iso_left_core, iso_right_core) + elif core.core_type == CoreType.Stacked: + insulation.add_top_section_core_insulations(iso_top_core, iso_bot_core, iso_left_core, iso_right_core) + insulation.add_bottom_section_core_insulations(iso_top_core, iso_bot_core, iso_left_core, iso_right_core) insulation.add_winding_insulations([[iso_primary_to_primary, iso_primary_to_secondary, iso_primary_to_secondary], [iso_primary_to_secondary, iso_secondary_to_secondary, iso_primary_to_secondary], [iso_primary_to_secondary, iso_primary_to_secondary, iso_secondary_to_secondary]]) @@ -301,18 +309,32 @@ def define_windings(winding_temperature: float): winding1, winding2, winding3 = define_windings(winding_temperature) def define_rows(): - primary_row = single_row(number_of_conds_per_winding=primary_turns, - window_width=core.window_w - insulation.core_cond[2] - insulation.core_cond[3], - winding_tag=WindingTag.Primary, - conductor_type=ConductorType.RoundLitz, - radius=primary_radius, - cond_cond_isolation=insulation.cond_cond[0][0]) - - secondary_row = single_row(number_of_conds_per_winding=secondary_parallel_turns, - window_width=core.window_w - insulation.core_cond[2] - insulation.core_cond[3], - winding_tag=WindingTag.Secondary, - conductor_type=ConductorType.RectangularSolid, - thickness=secondary_thickness_foil) + if core.core_type == CoreType.Single: + primary_row = single_row(number_of_conds_per_winding=primary_turns, + window_width=core.window_w - insulation.core_cond[2] - insulation.core_cond[3], + winding_tag=WindingTag.Primary, + conductor_type=ConductorType.RoundLitz, + radius=primary_radius, + cond_cond_isolation=insulation.cond_cond[0][0]) + + secondary_row = single_row(number_of_conds_per_winding=secondary_parallel_turns, + window_width=core.window_w - insulation.core_cond[2] - insulation.core_cond[3], + winding_tag=WindingTag.Secondary, + conductor_type=ConductorType.RectangularSolid, + thickness=secondary_thickness_foil) + elif core.core_type == CoreType.Stacked: + primary_row = single_row(number_of_conds_per_winding=primary_turns, + window_width=core.window_w - insulation.top_section_core_cond[2] - insulation.top_section_core_cond[3], + winding_tag=WindingTag.Primary, + conductor_type=ConductorType.RoundLitz, + radius=primary_radius, + cond_cond_isolation=insulation.cond_cond[0][0]) + + secondary_row = single_row(number_of_conds_per_winding=secondary_parallel_turns, + window_width=core.window_w - insulation.bot_section_core_cond[2] - insulation.bot_section_core_cond[3], + winding_tag=WindingTag.Secondary, + conductor_type=ConductorType.RectangularSolid, + thickness=secondary_thickness_foil) tertiary_row = copy.deepcopy(secondary_row) tertiary_row.winding_tag = WindingTag.Tertiary @@ -353,4 +375,4 @@ def define_rows(): if core.core_type == CoreType.Single: return insulation, ww_bot elif core.core_type == CoreType.Stacked: - return insulation, ww_top, ww_bot + return insulation, ww_top, ww_bot \ No newline at end of file diff --git a/femmt/mesh.py b/femmt/mesh.py index b7d7bf25..efb0d732 100644 --- a/femmt/mesh.py +++ b/femmt/mesh.py @@ -1016,15 +1016,17 @@ def air_stacked(self, l_core_air: list, l_bound_air: List, curve_loop_cond: list l_air_top = l_core_air[0:5] + [l_bound_air[0]] curve_loop_air_top = [gmsh.model.geo.addCurveLoop(l_air_top, -1, True)] flatten_curve_loop_cond_top = primary_in_top + secondary_in_top + tertiary_in_top - curve_loop_iso_core_top = [] # TODO: insulations - self.plane_surface_air_top.append(gmsh.model.geo.addPlaneSurface(curve_loop_air_top + flatten_curve_loop_cond_top + curve_loop_iso_core_top)) + # curve_loop_iso_core_top = [] # TODO: insulations + curve_loop_iso_top_core = primary_in_top + secondary_in_top + tertiary_in_top + self.plane_surface_air_top.append(gmsh.model.geo.addPlaneSurface(curve_loop_air_top + flatten_curve_loop_cond_top + curve_loop_iso_top_core)) # bot window l_air_bot = l_core_air[5:12] + [l_bound_air[1]] curve_loop_air_bot = [gmsh.model.geo.addCurveLoop(l_air_bot, -1, True)] flatten_curve_loop_cond_bot = primary_in_bot + secondary_in_bot + tertiary_in_bot - curve_loop_iso_core_bot = [] # TODO: insulations - self.plane_surface_air_bot.append(gmsh.model.geo.addPlaneSurface(curve_loop_air_bot + flatten_curve_loop_cond_bot + curve_loop_iso_core_bot)) + # curve_loop_iso_core_bot = [] # TODO: insulations + curve_loop_iso_bot_core = primary_in_bot + secondary_in_bot + tertiary_in_bot + self.plane_surface_air_bot.append(gmsh.model.geo.addPlaneSurface(curve_loop_air_bot + flatten_curve_loop_cond_bot + curve_loop_iso_bot_core)) # TODO: How to select the conductors which are in the top and which are in the bot vww? -> Need to be cut out of the air... # l_air_top = l_core_air[0:5] + [l_bound_air[0]] @@ -1244,13 +1246,8 @@ def generate_hybrid_mesh(self, color_scheme: Dict = ff.colors_femmt_default, col # TODO: Add model_insulation as an input parameter of the function. if self.insulation.flag_insulation: if self.model.component_type == ComponentType.IntegratedTransformer: - if self.stray_path: - curve_loop_iso_core, curve_loop_iso_top_core, curve_loop_iso_bot_core = (self.insulations_core_cond - ([], p_iso_top_core, p_iso_bot_core)) - else: - warnings.warn("Insulations are currently not implemented for integrated transformer and will be ignored.", - stacklevel=2) - # TODO: Implement insulations for integrated transformer. + curve_loop_iso_core, curve_loop_iso_top_core, curve_loop_iso_bot_core = (self.insulations_core_cond( + [], p_iso_top_core, p_iso_bot_core)) else: curve_loop_iso_core, curve_loop_iso_top_core, curve_loop_iso_bot_core = self.insulations_core_cond(p_iso_core, [], []) else: diff --git a/femmt/model.py b/femmt/model.py index 39d5f70a..9fe133d9 100644 --- a/femmt/model.py +++ b/femmt/model.py @@ -776,6 +776,8 @@ def add_bottom_section_core_insulations(self, top_core: float, bot_core: float, :param right_core: Insulation between winding window and right of the bot section core :type right_core: float """ + if top_core is None: + top_core = 0 if bot_core is None: bot_core = 0 if left_core is None: @@ -784,16 +786,6 @@ def add_bottom_section_core_insulations(self, top_core: float, bot_core: float, right_core = 0 self.bot_section_core_cond = [top_core, bot_core, left_core, right_core] - - # def to_dict(self): - # """Transfer object parameters to a dictionary. Important method to create the final result-log.""" - # if len(self.cond_cond) == 0: - # return {} - # - # return { - # "inner_winding_insulations": self.cond_cond, - # "core_insulations": self.core_cond - # } def to_dict(self): """Transfer object parameters to a dictionary.""" result = { @@ -1097,10 +1089,10 @@ def __init__(self, core: Core, insulations: Insulation, stray_path: StrayPath = self.max_left_bound = core.core_inner_diameter / 2 + insulations.core_cond[2] self.max_right_bound = core.r_inner - insulations.core_cond[3] elif self.core.core_type == CoreType.Stacked: # top, bot, left, right - self.max_bot_bound = -core.window_h_bot / 2 + insulations.core_cond[1] - self.max_top_bound = core.window_h_bot / 2 + core.window_h_top + core.core_thickness - insulations.core_cond[0] - self.max_left_bound = core.core_inner_diameter / 2 + insulations.core_cond[2] - self.max_right_bound = core.r_inner - insulations.core_cond[3] + self.max_bot_bound = -core.window_h_bot / 2 + insulations.bot_section_core_cond[1] + self.max_top_bound = core.window_h_bot / 2 + core.window_h_top + core.core_thickness - insulations.top_section_core_cond[0] + self.max_left_bound = core.core_inner_diameter / 2 + insulations.top_section_core_cond[2] + self.max_right_bound = core.r_inner - insulations.top_section_core_cond[3] # Insulations self.insulations = insulations @@ -1189,8 +1181,8 @@ def split_window(self, split_type: WindingWindowSplit, split_distance: float = 0 elif split_type == WindingWindowSplit.NoSplitWithBobbin: bobbin_def = [top_bobbin, bot_bobbin, left_bobbin, right_bobbin] for index, element in enumerate(bobbin_def): - if element is not None and element > self.insulations.core_cond[index]: - bobbin_def[index] = self.insulations.core_cond[index] - element + if element is not None and element > self.insulations.top_section_core_cond[index]: + bobbin_def[index] = self.insulations.top_section_core_cond[index] - element else: bobbin_def[index] = 0