Skip to content

Commit 0beb3ba

Browse files
committed
Update after decision to keep saturation threshold within FEMMT.
1 parent 9e262e4 commit 0beb3ba

3 files changed

Lines changed: 10 additions & 30 deletions

File tree

femmt/examples/basic_inductor_with_dc_offset.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Current amplitute
2020
current_amplitude_list: list[float] = [3]
2121
# Current offset
22-
current_offset: float = 20
22+
current_offset: float = 10
2323
# Target inductance (L_is)
2424
target_inductance = 2e-05
2525
# Deviation to target inductance (abs(L_is/L_shall)
@@ -124,8 +124,6 @@ def basic_example_inductor_with_dc_offset(onelab_folder: str = None, show_visual
124124
# Set insulation
125125
geo.set_insulation(insulation)
126126
geo.set_winding_windows([winding_window])
127-
# Increase material saturation maximum
128-
geo.set_saturation_threshold(2)
129127

130128
# List of inductance for better approximation
131129
inductance_list: list[tuple[float, float, float]] = []

femmt/examples/ito_optuna_example.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
import femmt as fmt
1212
from materialdatabase.meta.data_enums import Material, DataSource
1313

14-
i_2 = [[0.0, 3.265248131976911e-07, 2.5e-06, 2.8265248131976912e-06, 5e-06],
15-
[-0.9196195846583147, -19.598444313231134, 0.9196195846583122, 19.59844431323113, -0.9196195846583147]]
16-
1714
i_offset = 6
1815
ac_factor = 1
1916

@@ -128,7 +125,7 @@
128125

129126
volume, combined_losses, area_to_heat_sink, winding_loss, core_loss = fmt.InductorOptimization.FemSimulation.full_simulation(
130127
df_geometry_re_simulation_number, current_waveform=i_1,
131-
inductor_config_filepath=config_filepath, process_number=1, print_derivations=False, saturation_threshold=1.5)
128+
inductor_config_filepath=config_filepath, process_number=1, print_derivations=False)
132129

133130
if task_plot_study_results:
134131
fmt.InductorOptimization.ReluctanceModel.show_study_results(fmt_inductor_optimization_dto)

femmt/optimization/io.py

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
class InductorOptimization:
3434
"""Reluctance model and FEM simulation for the inductor optimization."""
3535

36+
# Saturation threshold for calculation with Inductor optimization
37+
_IO_SATURATION_THRESHOLD = 0.8
38+
3639
@staticmethod
3740
def filter_df(df: pd.DataFrame, x: str = "values_0", y: str = "values_1", factor_min_dc_losses: float = 1.2,
3841
factor_max_dc_losses: float = 10) -> pd.DataFrame:
@@ -437,9 +440,9 @@ def single_reluctance_model_simulation_dc_offset(reluctance_input: IoReluctanceM
437440
previous_dynamic_mu_r_abs = dynamic_mu_r_abs
438441

439442
# Do not cross out saturation, as the genetic algorithm is missing bad results to improve its suggestions
440-
if flux_avg_density > 0.8 * reluctance_input.initial_mag_curve["b"].iloc[-1] or dynamic_mu_r_abs < 0:
441-
print(f"Average flux density is too high (80 % of b_sat): {flux_avg_density} "
442-
f"T > 0.8 * {reluctance_input.initial_mag_curve['b'].iloc[-1]} T mur={dynamic_mu_r_abs}")
443+
if flux_avg_density > reluctance_input.initial_mag_curve["b"].iloc[-1] or dynamic_mu_r_abs < 0:
444+
logger.info(f"Average flux density exceeds range of initial magnetization curve: {flux_avg_density} "
445+
f"T > {reluctance_input.initial_mag_curve['b'].iloc[-1]} T mur={dynamic_mu_r_abs}")
443446
reluctance_model_output = IoReluctanceModelOutput(
444447
p_loss_total=float('nan'),
445448
volume=float('nan'),
@@ -469,22 +472,6 @@ def single_reluctance_model_simulation_dc_offset(reluctance_input: IoReluctanceM
469472
flux_amplitude = (flux.max() - flux.min())/2
470473
flux_amplitude_density = flux_amplitude / core_cross_section
471474

472-
# Do not cross out saturation, as the genetic algorithm is missing bad results to improve its suggestions
473-
if (flux_avg_density + flux_amplitude_density) > 0.8 * reluctance_input.initial_mag_curve["b"].iloc[-1]:
474-
print(f"Maximum flux density is too high (80 % of b_sat): {flux_avg_density + flux_amplitude_density} "
475-
f"T > 0.8 * {reluctance_input.initial_mag_curve['b'].iloc[-1]} T mur={dynamic_mu_r_abs}")
476-
reluctance_model_output = IoReluctanceModelOutput(
477-
p_loss_total=float('nan'),
478-
volume=float('nan'),
479-
area_to_heat_sink=float('nan'),
480-
p_winding=float('nan'),
481-
p_hyst=float('nan'),
482-
l_air_gap=float('nan'),
483-
flux_density_peak=flux_avg_density + flux_amplitude_density,
484-
dynamic_mu_r_abs=float('nan')
485-
)
486-
return reluctance_model_output
487-
488475
# p_loss calculation
489476
# get power loss in W/m³ and estimated H wave in A/m
490477
p_density_cmp, _ = reluctance_input.magnet_material_model(flux_density, reluctance_input.fundamental_frequency, reluctance_input.temperature)
@@ -1449,7 +1436,7 @@ def filter_combined_loss_list_df(df: pd.DataFrame, factor_min_dc_losses: float =
14491436

14501437
@staticmethod
14511438
def full_simulation(df_geometry: pd.DataFrame, current_waveform: list, inductor_config_filepath: str, process_number: int = 1,
1452-
print_derivations: bool = False, saturation_threshold: float = 0.7) -> tuple:
1439+
print_derivations: bool = False) -> tuple:
14531440
"""
14541441
FEM simulation (winding losses and hysteresis losses from magnet model) for geometries from df_geometry.
14551442
@@ -1463,8 +1450,6 @@ def full_simulation(df_geometry: pd.DataFrame, current_waveform: list, inductor_
14631450
:type process_number: int
14641451
:param print_derivations: True to print derivation from FEM simulation to reluctance model
14651452
:type print_derivations: bool
1466-
:param saturation_threshold: Threshold of maximum material saturation (default: 0.7)
1467-
:type saturation_threshold: float
14681453
:return: volume, loss
14691454
:rtype: tuple
14701455
"""
@@ -1534,7 +1519,7 @@ def full_simulation(df_geometry: pd.DataFrame, current_waveform: list, inductor_
15341519
time_vec=target_and_fix_parameters.time_extracted_vec,
15351520
current_vec=target_and_fix_parameters.current_extracted_vec,
15361521
current_offset=target_and_fix_parameters.current_offset,
1537-
saturation_threshold=saturation_threshold
1522+
saturation_threshold=InductorOptimization._IO_SATURATION_THRESHOLD
15381523
)
15391524

15401525
# Load reluctance model input for magnet model and litz wire resistance calculation

0 commit comments

Comments
 (0)