Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions femmt/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ def thermal_simulation(self, thermal_conductivity_dict: dict, boundary_temperatu
"winding_tags": self.mesh.ps_cond,
"air_gaps_tag": self.mesh.ps_air_gaps if self.air_gaps.number > 0 else None,
"boundary_regions": self.mesh.thermal_boundary_region_tags,
"insulations_tag": self.mesh.ps_insulation if flag_insulation and len(
self.insulation.core_cond) == 4 else None
"insulations_tag": self.mesh.ps_insulation if flag_insulation else None
}

# Core area -> Is needed to estimate the heat flux
Expand Down Expand Up @@ -436,6 +435,15 @@ def set_insulation(self, insulation: Insulation):
:param insulation: insulation object
:type insulation: Insulation
"""
# For integrated transformers, check if top and bottom core insulations are set
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")
else:
if insulation.cond_cond is None or not insulation.cond_cond:
raise Exception("insulations between the conductors must be set")

if self.simulation_type == SimulationType.ElectroStatic:
insulation.bobbin_dimensions = True
else:
Expand All @@ -444,12 +452,6 @@ def set_insulation(self, insulation: Insulation):
if self.simulation_type == SimulationType.ElectroStatic and insulation.bobbin_dimensions is None:
raise Exception("bobbin parameters must be set in electrostatic simulations")

if insulation.cond_cond is None or not insulation.cond_cond:
raise Exception("insulations between the conductors must be set")

if insulation.core_cond is None or not insulation.core_cond:
raise Exception("insulations between the core and the conductors must be set")

self.insulation = insulation

def set_stray_path(self, stray_path: StrayPath):
Expand Down
276 changes: 273 additions & 3 deletions femmt/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class TwoDaxiSymmetric:
p_window: np.ndarray
p_air_gaps: np.ndarray
# p_conductor: list[list[float]]
p_iso_top_core: list[list[float]]
p_iso_bot_core: list[list[float]]
p_iso_core: list[list[float]]
p_iso_pri_sec: list[list[float]]

Expand Down Expand Up @@ -65,6 +67,8 @@ def __init__(self, core: Core, mesh_data: MeshData, air_gaps: AirGaps, winding_w
self.p_conductor = []
self.p_iso_conductor = []
self.p_iso_core = []
self.p_iso_top_core = []
self.p_iso_bot_core = []
self.p_iso_pri_sec = []
self.p_iso_layer = []

Expand Down Expand Up @@ -1599,9 +1603,274 @@ def draw_insulations(self):
return # if flag_insulation is False, just return without drawing insulations

if self.component_type == ComponentType.IntegratedTransformer:
# TODO: insulations implement for integrated_transformers
# TODO Change back to warnings?
logger.info("Insulations are not set because they are not implemented for integrated transformers.")
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

# 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]
air_gap_2_position = self.air_gaps.midpoints[start_index + 1][1]
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)
top_section_top_y = window_h / 2 - insulation_delta
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

# 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_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
]
]
# 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_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
]
]
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
iso = self.insulation
Expand Down Expand Up @@ -1753,6 +2022,7 @@ def draw_insulations(self):
]

self.p_iso_core = [iso_core_left, iso_core_top, iso_core_right, iso_core_bot]

else:

if self.insulation.max_aspect_ratio == 0:
Expand Down
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 @@ -149,7 +149,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
7 changes: 4 additions & 3 deletions femmt/examples/basic_transformer_integrated.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ 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.002, 0.001)
insulation = fmt.Insulation(flag_insulation=True)
insulation.add_top_section_core_insulations(0.001, 0.001, 0.002, 0.001)
insulation.add_bottom_section_core_insulations(0.002, 0.001, 0.001, 0.002)
insulation.add_winding_insulations([[0.0002, 0.001],
[0.001, 0.0002]], per_layer_of_turns=False)
geo.set_insulation(insulation)
Expand Down Expand Up @@ -161,7 +162,7 @@ def example_thermal_simulation(show_thermal_visual_outputs: bool = True, flag_in
# other simulation options:
# -------------------------
# geo.get_inductances(I0=10, op_frequency=100000, skin_mesh_factor=0.5)
example_thermal_simulation(show_visual_outputs, flag_insulation=False)
example_thermal_simulation(show_visual_outputs, flag_insulation=True)


if __name__ == "__main__":
Expand Down
10 changes: 6 additions & 4 deletions femmt/examples/basic_transformer_stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,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]], per_layer_of_turns=False)
geo.set_insulation(insulation)

Expand Down Expand Up @@ -158,7 +160,7 @@ def example_thermal_simulation(show_thermal_visual_outputs: bool = True, flag_in
# -------------------------
# geo.get_inductances(I0=10, op_frequency=100000, skin_mesh_factor=0.5)
# 7. prepare and start thermal simulation
example_thermal_simulation(show_visual_outputs, flag_insulation=False)
example_thermal_simulation(show_visual_outputs, flag_insulation=True)


if __name__ == "__main__":
Expand Down
Loading