Describe the bug
Seems like there is a change in string-enums when switching from python 3.10 to 3.11. This behaviour was tested on windows and linux.
To Reproduce
Run this example code on python 3.11
# Working directory can be set arbitrarily
working_directory = os.path.join(example_results_folder, "inductor")
if not os.path.exists(working_directory):
os.mkdir(working_directory)
# 1. chose simulation type
geo = fmt.MagneticComponent(component_type=fmt.ComponentType.Inductor, working_directory=working_directory, silent=True)
inductor_frequency = 270000
# 2. set core parameters
core_db = fmt.core_database()["PQ 40/40"]
core_dimensions = fmt.dtos.SingleCoreDimensions(core_inner_diameter=core_db["core_inner_diameter"],
window_w=core_db["window_w"],
window_h=core_db["window_h"])
core = fmt.Core(core_type=fmt.CoreType.Single,
core_dimensions=core_dimensions,
material="N49", temperature=45, frequency=inductor_frequency,
# permeability_datasource="manufacturer_datasheet",
permeability_datasource=fmt.MaterialDataSource.Measurement,
permeability_datatype=fmt.MeasurementDataType.ComplexPermeability,
permeability_measurement_setup="LEA_LK",
permittivity_datasource=fmt.MaterialDataSource.Measurement,
permittivity_datatype=fmt.MeasurementDataType.ComplexPermittivity,
permittivity_measurement_setup="LEA_LK")
# mu_rel=3000, phi_mu_deg=10,
# sigma=0.5)
geo.set_core(core)
# 3. set air gap parameters
air_gaps = fmt.AirGaps(fmt.AirGapMethod.Percent, core)
air_gaps.add_air_gap(fmt.AirGapLegPosition.CenterLeg, 0.0005, 50)
# air_gaps.add_air_gap(fmt.AirGapLegPosition.CenterLeg, 0.0002, 90)
geo.set_air_gaps(air_gaps)
# 4. set insulations
insulation = fmt.Insulation()
insulation.add_core_insulations(0.001, 0.001, 0.004, 0.001)
insulation.add_winding_insulations([[0.0005]])
geo.set_insulation(insulation)
# 5. create winding window and virtual winding windows (vww)
winding_window = fmt.WindingWindow(core, insulation)
vww = winding_window.split_window(fmt.WindingWindowSplit.NoSplit)
# 6. create conductor and set parameters: use solid wires
winding = fmt.Conductor(0, fmt.Conductivity.Copper, winding_material_temperature=45)
winding.set_solid_round_conductor(conductor_radius=0.0013, conductor_arrangement=fmt.ConductorArrangement.Square)
winding.parallel = False # set True to make the windings parallel, currently only for solid conductors
#winding.set_litz_round_conductor(conductor_radius=0.0013, number_strands=150, strand_radius=100e-6,
#fill_factor=None, conductor_arrangement=fmt.ConductorArrangement.Square)
# 7. add conductor to vww and add winding window to MagneticComponent
vww.set_winding(winding, 9, None)
geo.set_winding_windows([winding_window])
# 8. create the model
geo.create_model(freq=inductor_frequency, pre_visualize_geometry=True, save_png=False)
# 6.a. start simulation
geo.single_simulation(freq=inductor_frequency, current=[4.5],
plot_interpolation=False, show_fem_simulation_results=True)
Expected behavior
Simulation should run without any problems.
Screenshots
Traceback (most recent call last):
File "\FEM_Magnetics_Toolbox\femmt\examples\basic_example.py", line 147, in <module>
geo.single_simulation(freq=inductor_frequency, current=[4.5],
File "\FEM_Magnetics_Toolbox\femmt\component.py", line 836, in single_simulation
self.excitation(frequency=freq, amplitude_list=current, phase_deg_list=phi_deg, plot_interpolation=plot_interpolation) # frequency and current
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\FEM_Magnetics_Toolbox\femmt\component.py", line 702, in excitation
self.core.update_core_material_pro_file(frequency, self.file_data.electro_magnetic_folder_path, plot_interpolation) # frequency update to core class
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\FEM_Magnetics_Toolbox\femmt\model.py", line 388, in update_core_material_pro_file
self.material_database.permeability_data_to_pro_file(temperature=self.temperature, frequency=frequency,
File "\materialdatabase\materialdatabase\material_data_base_classes.py", line 99, in permeability_data_to_pro_file
permeability_data = self.data[f"{material_name}"][f"measurements"][f"{datatype}"][f"{measurement_setup}"][
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'MeasurementDataType.ComplexPermeability'
Desktop (please complete the following information):
Windows python 3.10: works
Windows python 3.11: fails
Linux python 3.10: works
Windows python 3.11: fails
Describe the bug Seems like there is a change in string-enums when switching from python
3.10
to3.11
. This behaviour was tested on windows and linux.To Reproduce Run this example code on python 3.11
Expected behavior Simulation should run without any problems.
Screenshots
Desktop (please complete the following information): Windows python 3.10: works Windows python 3.11: fails Linux python 3.10: works Windows python 3.11: fails