Skip to content

Commit

Permalink
adding the insulation for stacked core
Browse files Browse the repository at this point in the history
  • Loading branch information
abujazar committed Oct 10, 2024
1 parent f397e69 commit 4f9a82a
Show file tree
Hide file tree
Showing 7 changed files with 312 additions and 292 deletions.
2 changes: 1 addition & 1 deletion femmt/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
495 changes: 251 additions & 244 deletions femmt/drawing.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion femmt/examples/basic_transformer_center_tapped.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down
8 changes: 5 additions & 3 deletions femmt/examples/basic_transformer_stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
54 changes: 38 additions & 16 deletions femmt/functions_topologies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]])
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
19 changes: 8 additions & 11 deletions femmt/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down Expand Up @@ -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:
Expand Down
24 changes: 8 additions & 16 deletions femmt/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4f9a82a

Please sign in to comment.