Skip to content

Commit 0b1f079

Browse files
author
abujazar
committed
remove some functions that are not needed. Fixing the test file bugs
1 parent 6097798 commit 0b1f079

13 files changed

Lines changed: 730 additions & 635 deletions

femmt/component.py

Lines changed: 89 additions & 321 deletions
Large diffs are not rendered by default.

femmt/drawing.py

Lines changed: 15 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,29 +1023,26 @@ def draw_conductors(self, draw_top_down: bool = True):
10231023

10241024
i += 1
10251025

1026-
# Insert Kapton insulation after each layer
1027-
# self.insert_kapton_layer_vertical(x + winding.conductor_radius + self.insulation.cond_cond[num][num] , top_bound, bot_bound, left_bound, right_bound)
1028-
# self.insert_kapton_layer_vertical(x_l, top_bound,
1029-
# bot_bound, left_bound, right_bound)
1026+
# Insert insulation after each layer
10301027
mesh_to_conductor = min(self.mesh_data.c_conductor)
10311028
if rightward_movement:
1032-
kapton_points = [
1029+
layer_insulation_points = [
10331030
[x_l + insulation_delta, top_bound, 0, mesh_to_conductor],
10341031
[x_l + self.insulation.thickness_of_insulation - insulation_delta, top_bound, 0, mesh_to_conductor],
10351032
[x_l + self.insulation.thickness_of_insulation - insulation_delta, bot_bound, 0, mesh_to_conductor],
10361033
[x_l + insulation_delta, bot_bound, 0, mesh_to_conductor]
10371034
]
10381035
else:
1039-
kapton_points = [
1036+
layer_insulation_points = [
10401037
[x_l - insulation_delta, top_bound, 0, mesh_to_conductor],
10411038
[x_l - self.insulation.thickness_of_insulation + insulation_delta, top_bound, 0, mesh_to_conductor],
10421039
[x_l - self.insulation.thickness_of_insulation + insulation_delta, bot_bound, 0, mesh_to_conductor],
10431040
[x_l - insulation_delta, bot_bound, 0, mesh_to_conductor]
10441041
]
1045-
# Add the points to the Kapton insulation data structure
1042+
# Add the points to the layer insulation data structure
10461043
#if self.insulation.thickness_of_insulation > 0 :
10471044
if self.insulation.draw_insulation_between_layers:
1048-
self.p_iso_layer.append(kapton_points)
1045+
self.p_iso_layer.append(layer_insulation_points)
10491046
if not zigzag:
10501047
# Start the next column with the same starting point (consistent direction)
10511048
y = start_y
@@ -1101,25 +1098,24 @@ def draw_conductors(self, draw_top_down: bool = True):
11011098
else:
11021099
x += step_x - winding_insulation
11031100
i += 1
1104-
# Insert Kapton insulation after each layer
1105-
# self.insert_kapton_layer_horizontal(y, left_bound, right_bound)
1101+
# Insert layer insulation after each layer
11061102
if upward_movement:
1107-
kapton_points = [
1103+
layer_insulation_points = [
11081104
[left_bound, y_l + insulation_delta, 0, self.mesh_data.c_window],
11091105
[left_bound, y_l + self.insulation.thickness_of_insulation - insulation_delta, 0, self.mesh_data.c_window],
11101106
[right_bound, y_l + self.insulation.thickness_of_insulation - insulation_delta, 0, self.mesh_data.c_window],
11111107
[right_bound, y_l + insulation_delta, 0, self.mesh_data.c_window]
11121108
]
11131109
else:
1114-
kapton_points = [
1110+
layer_insulation_points = [
11151111
[left_bound, y_l - insulation_delta, 0, self.mesh_data.c_window],
11161112
[left_bound, y_l - self.insulation.thickness_of_insulation + insulation_delta, 0, self.mesh_data.c_window],
11171113
[right_bound, y_l - self.insulation.thickness_of_insulation + insulation_delta, 0, self.mesh_data.c_window],
11181114
[right_bound, y_l - insulation_delta, 0, self.mesh_data.c_window]
11191115
]
1120-
# Add the points to the Kapton insulation data structure
1116+
# Add the points to the layer insulation data structure
11211117
if self.insulation.draw_insulation_between_layers:
1122-
self.p_iso_layer.append(kapton_points)
1118+
self.p_iso_layer.append(layer_insulation_points)
11231119
if not zigzag:
11241120
# Start the next raw with the same starting point (consistent direction)
11251121
x = start_x
@@ -1232,14 +1228,14 @@ def draw_conductors(self, draw_top_down: bool = True):
12321228
else:
12331229
y += winding.conductor_radius * 2 + 2 * self.insulation.cond_cond[num][num] + winding_insulation
12341230
# from bottom to top
1235-
kapton_points = [
1231+
layer_insulation_points = [
12361232
[start_x_layer + insulation_delta, top_bound, 0, mesh_to_conductor],
12371233
[start_x_layer + self.insulation.thickness_of_insulation - insulation_delta, top_bound, 0, mesh_to_conductor],
12381234
[start_x_layer + self.insulation.thickness_of_insulation - insulation_delta, bot_bound, 0, mesh_to_conductor],
12391235
[start_x_layer + insulation_delta, bot_bound, 0, mesh_to_conductor]
12401236
]
12411237
if self.insulation.draw_insulation_between_layers:
1242-
self.p_iso_layer.append(kapton_points)
1238+
self.p_iso_layer.append(layer_insulation_points)
12431239
x += 2 * np.cos(np.pi / 6) * (winding.conductor_radius + self.insulation.turn_ins[num][num] / 2 + self.insulation.thickness_of_insulation)
12441240
# x += np.cos(np.pi / 6) * (2 * winding.conductor_radius + 2 * self.insulation.cond_cond[num][num]) + self.insulation.thickness_of_insulation
12451241
start_x_layer += step_x_layer
@@ -1317,15 +1313,15 @@ def draw_conductors(self, draw_top_down: bool = True):
13171313
else:
13181314
x += winding.conductor_radius * 2 + 2 * self.insulation.turn_ins[num][num] + winding_insulation
13191315

1320-
# Insert Kapton insulation after each layer
1321-
kapton_points = [
1316+
# Insert layer insulation after each layer
1317+
layer_insulation_points = [
13221318
[left_bound, start_y_layer + insulation_delta, 0, mesh_to_conductor],
13231319
[left_bound, start_y_layer + self.insulation.thickness_of_insulation - insulation_delta, 0, mesh_to_conductor],
13241320
[right_bound, start_y_layer + self.insulation.thickness_of_insulation - insulation_delta, 0, mesh_to_conductor],
13251321
[right_bound, start_y_layer + insulation_delta, 0, mesh_to_conductor]
13261322
]
13271323
if self.insulation.draw_insulation_between_layers:
1328-
self.p_iso_layer.append(kapton_points)
1324+
self.p_iso_layer.append(layer_insulation_points)
13291325

13301326
y += 2 * np.cos(np.pi / 6) * (winding.conductor_radius + self.insulation.turn_ins[num][num] / 2 + self.insulation.thickness_of_insulation)
13311327
start_y_layer += step_y_layer
@@ -1949,52 +1945,6 @@ def draw_insulations(self):
19491945
print("No insulations for winding type {vww.winding_type.name}")
19501946
"""
19511947

1952-
def insert_kapton_layer_vertical(self, x_position, top_bound, bot_bound, left_bound, right_bound):
1953-
"""
1954-
Insert a vertical Kapton insulation layer between layers.
1955-
1956-
:param x_position: x-coordinate where the Kapton layer is centered.
1957-
:param top_bound: The top boundary of the window.
1958-
:param bot_bound: The bottom boundary of the window.
1959-
"""
1960-
kapton_thickness = self.insulation.thickness_of_insulation # Thickness of the Kapton insulation
1961-
# define a delta insulation
1962-
insulation_delta = self.mesh_data.c_window / self.insulation.max_aspect_ratio
1963-
mesh_density_to_winding = min(self.mesh_data.c_conductor)
1964-
1965-
# self.p_iso_layer= []
1966-
# Define points for the vertical Kapton insulation rectangle
1967-
kapton_points = [
1968-
[x_position + insulation_delta, top_bound, 0, self.mesh_data.c_window],
1969-
[x_position + kapton_thickness - insulation_delta, top_bound, 0, self.mesh_data.c_window],
1970-
[x_position + kapton_thickness - insulation_delta, bot_bound, 0, self.mesh_data.c_window],
1971-
[x_position + insulation_delta , bot_bound, 0, self.mesh_data.c_window]
1972-
]
1973-
1974-
# Add the points to the Kapton insulation data structure
1975-
self.p_iso_layer.append(kapton_points)
1976-
1977-
def insert_kapton_layer_horizontal(self, y_position, left_bound, right_bound):
1978-
"""
1979-
Insert a horizontal Kapton insulation layer between layers.
1980-
1981-
:param x_position: x-coordinate where the Kapton layer is centered.
1982-
:param left_bound: The left boundary of the window.
1983-
:param right_bound: The right boundary of the window.
1984-
"""
1985-
kapton_thickness = self.insulation.thickness_of_insulation # Thickness of the Kapton insulation
1986-
1987-
# Define points for the vertical Kapton insulation rectangle
1988-
kapton_points = [
1989-
[left_bound, y_position - kapton_thickness / 2, 0, self.mesh_data.c_window],
1990-
[left_bound, y_position + kapton_thickness / 2, 0, self.mesh_data.c_window],
1991-
[right_bound, y_position + kapton_thickness / 2, 0, self.mesh_data.c_window],
1992-
[right_bound, y_position - kapton_thickness / 2, 0, self.mesh_data.c_window]
1993-
]
1994-
1995-
# Add the points to the Kapton insulation data structure
1996-
self.p_iso_layer.append(kapton_points)
1997-
19981948
def draw_insulation_conductor(self):
19991949
"""
20001950
Draw insulation around each conductor turn.

femmt/electro_magnetic/fileds_electrostatic_2.pro

Whitespace-only changes.

femmt/electro_magnetic/inductor_test_capacitance.py

Whitespace-only changes.

femmt/examples/basic_inducotr_electrostatic.py renamed to femmt/examples/basic_inductor_electrostatic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ def basic_example_inductor_electrostatic(onelab_folder: str = None, show_visual_
113113
V_A - (V_A - V_B) * i / (num_turns_w1 - 1)
114114
for i in range(num_turns_w1)
115115
]
116-
geo.electrostatic_simulation(voltage=[voltages_winding_1], ground_outer_boundary=False, core_voltage=0,
117-
show_fem_simulation_results=show_visual_outputs, save_to_excel=False)
116+
geo.electrostatic_simulation(voltage=[voltages_winding_1], ground_outer_boundary=True, core_voltage=0,
117+
show_fem_simulation_results=show_visual_outputs, save_to_excel_file=False)
118118
# Run simulation in FEMM
119119
# geo.femm_reference_electrostatic(voltages=[voltages_winding_1], ground_core=True, ground_outer_boundary=True,
120-
# non_visualize=0, save_to_excel=False, compare_excel_files_to_femmt=False, mesh_size_conductor=0.0)
120+
# non_visualize=0, save_to_excel_file=False, compare_femmt_to_femm=False, mesh_size_conductor=0.0)
121121

122122

123123
if __name__ == "__main__":

femmt/examples/basic_inductor_foil_vertical_electrostatic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ def basic_example_inductor_foil_vertical_electrostatic(onelab_folder: str = None
8787
# 8. run electrostatic simulation
8888

8989
geo.electrostatic_simulation(voltage=[[1, 0.5, 0]], ground_outer_boundary=False, core_voltage=0,
90-
show_fem_simulation_results=show_visual_outputs, save_to_excel=False)
90+
show_fem_simulation_results=show_visual_outputs, save_to_excel_file=False)
9191
# Call the electrostatic FEMM simulation function
9292
# voltages = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140]
9393
# geo.femm_reference_electrostatic(voltages=[[5, 0]], ground_core=True, ground_outer_boundary=False,
94-
# non_visualize=0, save_to_excel=True, compare_excel_files_to_femmt=True, mesh_size_conductor=0.0)
94+
# non_visualize=0, save_to_excel_file=True, compare_femmt_to_femm=True, mesh_size_conductor=0.0)
9595

9696

9797
if __name__ == "__main__":

femmt/examples/basic_transformer_electrostatic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ def basic_example_transformer_electrostatic(onelab_folder: str = None, show_visu
233233
# voltages_winding_1 = [1] * num_turns_w1
234234
# voltages_winding_2 = [2] * num_turns_w2
235235

236-
geo.electrostatic_simulation( voltage=[voltages_winding_1, voltages_winding_2], core_voltage=0, ground_outer_boundary=False,
237-
show_fem_simulation_results=show_visual_outputs, save_to_excel=False)
236+
geo.electrostatic_simulation(voltage=[voltages_winding_1, voltages_winding_2], core_voltage=0, ground_outer_boundary=False,
237+
show_fem_simulation_results=show_visual_outputs, save_to_excel_file=False)
238238
# geo.get_total_charges()
239-
# geo.femm_reference_electrostatic(voltages=[voltages_winding_1, voltages_winding_2], ground_core=True, ground_outer_boundary=True, non_visualize=0, save_to_excel=False,
240-
# compare_excel_files_to_femmt=False)
239+
# geo.femm_reference_electrostatic(voltages=[voltages_winding_1, voltages_winding_2], ground_core=True, ground_outer_boundary=True, non_visualize=0, save_to_excel_file=False,
240+
# compare_femmt_to_femm=False)
241241

242242
if __name__ == "__main__":
243243
basic_example_transformer_electrostatic(show_visual_outputs=True)

femmt/examples/basic_transformer_stacked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def example_thermal_simulation(show_thermal_visual_outputs: bool = True, flag_in
128128
insulation.add_core_insulations(0.001, 0.001, 0.001, 0.001) # [bot, top, left, right]
129129
insulation.add_winding_insulations([[0.0002, 0.001],
130130
[0.001, 0.0002]], per_layer_of_turns=False)
131-
insulation.add_turn_insulation([0.25e-5], add_turn_insulations=False)
131+
insulation.add_turn_insulation([0.25e-5, 0.25e-5], add_turn_insulations=False)
132132
insulation.add_insulation_between_layers(add_insulation_material=False, thickness=0.0005)
133133
geo.set_insulation(insulation)
134134

0 commit comments

Comments
 (0)