Skip to content

Commit

Permalink
fix flux middle part sto
Browse files Browse the repository at this point in the history
  • Loading branch information
gituser789 committed Sep 4, 2024
1 parent 6496580 commit 915df23
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions femmt/optimization/sto.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def objective(trial: optuna.Trial, config: StoSingleInputConfig, target_and_fixe

flux_top = flux_matrix[0]
flux_bot = flux_matrix[1]
flux_middle = flux_top - flux_bot
flux_middle = flux_bot - flux_top

core_cross_section = (core_inner_diameter / 2) ** 2 * np.pi

Expand All @@ -204,7 +204,7 @@ def objective(trial: optuna.Trial, config: StoSingleInputConfig, target_and_fixe

# calculate air gaps to reach the target parameters
minimum_air_gap_length = 0.01e-3
maximum_air_gap_length = 4e-3
maximum_air_gap_length = 2e-3

try:
l_top_air_gap = optimize.brentq(
Expand Down Expand Up @@ -284,7 +284,7 @@ def objective(trial: optuna.Trial, config: StoSingleInputConfig, target_and_fixe
@staticmethod
def start_proceed_study(study_name: str, config: StoSingleInputConfig, number_trials: int,
storage: str = 'sqlite',
sampler=optuna.samplers.NSGAIISampler(),
sampler=optuna.samplers.NSGAIIISampler(),
show_geometries: bool = False,
) -> None:
"""
Expand Down Expand Up @@ -546,6 +546,7 @@ def fem_simulations_from_reluctance_df(reluctance_df: pd.DataFrame, config: StoS
time_current_vectors = np.array([config.time_current_1_vec, config.time_current_2_vec])

# pd.read_csv(current_waveforms_csv_file, header=0, index_col=0, delimiter=';')
df = pd.DataFrame()

for index, _ in reluctance_df.iterrows():

Expand Down Expand Up @@ -616,8 +617,15 @@ def fem_simulations_from_reluctance_df(reluctance_df: pd.DataFrame, config: StoS
geo.set_winding_windows([winding_window_top, winding_window_bot])

geo.create_model(freq=target_and_fix_parameters.fundamental_frequency, pre_visualize_geometry=show_visual_outputs, save_png=False)

geo.stacked_core_study(number_primary_coil_turns=primary_coil_turns, time_current_vectors=time_current_vectors,
plot_waveforms=show_visual_outputs, fft_filter_value_factor=0.05)

result_dict = geo.read_log()
print(f"{result_dict=}")
df_single_simulation = pd.DataFrame(result_dict)

df = pd.concat([df, df_single_simulation], axis=0)
except Exception as e:
print(e)

return df

0 comments on commit 915df23

Please sign in to comment.