From 7d4bdf1f44db5b4438b4b1503a21c9163838947b Mon Sep 17 00:00:00 2001 From: abujazar Date: Fri, 5 Jul 2024 12:03:34 +0200 Subject: [PATCH 01/11] change names of automated design and database --- gui/femmt_gui.ui | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gui/femmt_gui.ui b/gui/femmt_gui.ui index 8a537d95..50dfc6e7 100644 --- a/gui/femmt_gui.ui +++ b/gui/femmt_gui.ui @@ -45,7 +45,7 @@ - 0 + 2 @@ -61,7 +61,7 @@ - 0 + 1 @@ -2695,7 +2695,7 @@ - Automated Design + Automated Design (experimental) @@ -4582,7 +4582,7 @@ 0 0 - 635 + 98 518 @@ -4754,7 +4754,7 @@ 0 0 - 468 + 98 518 @@ -4809,8 +4809,8 @@ 0 0 - 268 - 253 + 1440 + 1172 @@ -4940,8 +4940,8 @@ 0 0 - 211 - 518 + 1400 + 807 @@ -4975,7 +4975,7 @@ - Database + Database (experimental) @@ -5011,7 +5011,7 @@ 0 0 - 43 + 1403 2036 @@ -9603,7 +9603,7 @@ 0 0 - 43 + 98 1024 From 9038a12dddec64e6b7484f636100cbe3ee90ec1c Mon Sep 17 00:00:00 2001 From: abujazar Date: Sat, 6 Jul 2024 20:39:05 +0200 Subject: [PATCH 02/11] change inductance value putton and add legends for grapghs in database. Review D-M grapghs. It seems there are some mistakes regrding legend in PC200, DMR96A and DMR96A2 --- gui/femmt_gui.py | 216 ++++++++++++++++++----------------------------- 1 file changed, 84 insertions(+), 132 deletions(-) diff --git a/gui/femmt_gui.py b/gui/femmt_gui.py index 9aa854a8..673471fc 100644 --- a/gui/femmt_gui.py +++ b/gui/femmt_gui.py @@ -1630,105 +1630,69 @@ def datupdateraph1(self, matplotlib_widget1, matplotlib_widget2, matplotlib_widg # show a statusbar while Datasheet-Datasheet is running self.statusBar().showMessage('Datasheet-Datasheet running...') QCoreApplication.processEvents() + try: + matplotlib_widget1.axis_cm.remove() + except: + pass + + material_list = [self.dat_core_material1_comboBox.currentText(), + self.dat_core_material2_comboBox.currentText(), + self.dat_core_material3_comboBox.currentText(), + self.dat_core_material4_comboBox.currentText(), + self.dat_core_material5_comboBox.currentText()] + temp_list = [comma_str_to_point_float(self.aut_temp_m1_comboBox.currentText()), + comma_str_to_point_float(self.aut_temp_m2_comboBox.currentText()), + comma_str_to_point_float(self.aut_temp_m3_comboBox.currentText()), + comma_str_to_point_float(self.aut_temp_m4_comboBox.currentText()), + comma_str_to_point_float(self.aut_temp_m5_comboBox.currentText())] + flux_list = [comma_str_to_point_float(self.aut_flux_m1_comboBox.currentText()), + comma_str_to_point_float(self.aut_flux_m2_comboBox.currentText()), + comma_str_to_point_float(self.aut_flux_m3_comboBox.currentText()), + comma_str_to_point_float(self.aut_flux_m4_comboBox.currentText()), + comma_str_to_point_float(self.aut_flux_m5_comboBox.currentText())] + + + materials_used_list = [item for item in material_list if item] + # First plot: Relative power loss vs B matplotlib_widget1.axis.clear() self.layout = QVBoxLayout(self.plotwidget) self.layout.addWidget(matplotlib_widget1) - try: - matplotlib_widget1.axis_cm.remove() - except: - pass - - mat1_name = self.dat_core_material1_comboBox.currentText() - mat2_name = self.dat_core_material2_comboBox.currentText() - mat3_name = self.dat_core_material3_comboBox.currentText() - mat4_name = self.dat_core_material4_comboBox.currentText() - mat5_name = self.dat_core_material5_comboBox.currentText() - - mat1_temp = comma_str_to_point_float(self.aut_temp_m1_comboBox.currentText()) - mat2_temp = comma_str_to_point_float(self.aut_temp_m2_comboBox.currentText()) - mat3_temp = comma_str_to_point_float(self.aut_temp_m3_comboBox.currentText()) - mat4_temp = comma_str_to_point_float(self.aut_temp_m4_comboBox.currentText()) - mat5_temp = comma_str_to_point_float(self.aut_temp_m5_comboBox.currentText()) - - mat1_flux = comma_str_to_point_float(self.aut_flux_m1_comboBox.currentText()) - mat2_flux = comma_str_to_point_float(self.aut_flux_m2_comboBox.currentText()) - mat3_flux = comma_str_to_point_float(self.aut_flux_m3_comboBox.currentText()) - mat4_flux = comma_str_to_point_float(self.aut_flux_m4_comboBox.currentText()) - mat5_flux = comma_str_to_point_float(self.aut_flux_m5_comboBox.currentText()) - - # print(f"mat1_name: {mat1_name},{mat2_name},{mat3_name},{mat4_name},{mat5_name}") - # print(f"mat1_temp: {mat1_temp},{mat2_temp},{mat3_temp},{mat4_temp},{mat5_temp}") - # print(f"mat1_flux: {mat1_flux},{mat2_flux},{mat3_flux},{mat4_flux},{mat5_flux}") - - materials_used_list = [] - material_list = [mat1_name, mat2_name, mat3_name, mat4_name, mat5_name] - for items in material_list: - if items: - materials_used_list.append(items) - # print(materials_used_list) - - database.compare_core_loss_flux_density_data(matplotlib_widget1, material_list=materials_used_list, - temperature_list=[mat1_temp, mat2_temp, mat3_temp, mat4_temp, - mat5_temp]) - # self.matplotlib_widget1.axis.legend(fontsize=13) + database.compare_core_loss_flux_density_data(matplotlib_widget1, material_list=materials_used_list, temperature_list=temp_list) + matplotlib_widget1.axis.legend([f'{mat}, {temp}°C' for mat, temp in zip(materials_used_list, temp_list)], fontsize=10) matplotlib_widget1.axis.grid() matplotlib_widget1.figure.canvas.draw_idle() matplotlib_widget1.figure.tight_layout() - ################################################################################################################ - + # Second plot: Relative power loss vs Temperature matplotlib_widget2.axis.clear() self.layout = QVBoxLayout(self.plotwidget_2) self.layout.addWidget(matplotlib_widget2) - try: - matplotlib_widget2.axis_cm.remove() - except: - pass - - flux_list = [mat1_flux, mat2_flux, mat3_flux, mat4_flux, mat5_flux] - # print(f"flux_list: {flux_list}") - database.compare_core_loss_temperature(matplotlib_widget2, material_list=materials_used_list, - flux_density_list=[mat1_flux, mat2_flux, mat3_flux, mat4_flux, - mat5_flux]) - # self.matplotlib_widget2.axis.legend(fontsize=13) + database.compare_core_loss_temperature(matplotlib_widget2, material_list=materials_used_list, flux_density_list=flux_list) + matplotlib_widget2.axis.legend([f'{mat}, {flux} T' for mat, flux in zip(materials_used_list, flux_list)], fontsize=10) matplotlib_widget2.axis.grid() matplotlib_widget2.figure.canvas.draw_idle() matplotlib_widget2.figure.tight_layout() - ################################################################################################################ - + # Third plot: Relative power loss vs Frequency matplotlib_widget3.axis.clear() self.layout = QVBoxLayout(self.plotwidget_3) self.layout.addWidget(matplotlib_widget3) - try: - matplotlib_widget3.axis_cm.remove() - except: - pass - - database.compare_core_loss_frequency(matplotlib_widget3, material_list=materials_used_list, - temperature_list=[mat1_temp, mat2_temp, mat3_temp, mat4_temp, mat5_temp], - flux_density_list=[mat1_flux, mat2_flux, mat3_flux, mat4_flux, mat5_flux]) - # self.matplotlib_widget3.axis.legend(fontsize=13) + database.compare_core_loss_frequency(matplotlib_widget3, material_list=materials_used_list, temperature_list=temp_list, flux_density_list=flux_list) + matplotlib_widget3.axis.legend([f'{mat}, {temp}°C, {flux} T' for mat, temp, flux in zip(materials_used_list, temp_list, flux_list)], fontsize=10) matplotlib_widget3.axis.grid() matplotlib_widget3.figure.canvas.draw_idle() matplotlib_widget3.figure.tight_layout() - ################################################################################################################ - + # Fourth plot: B vs H matplotlib_widget4.axis.clear() self.layout = QVBoxLayout(self.plotwidget_4) self.layout.addWidget(matplotlib_widget4) - try: - matplotlib_widget4.axis_cm.remove() - except: - pass - - database.compare_b_h_curve(matplotlib_widget4, material_list=materials_used_list, - temperature_list=[mat1_temp, mat2_temp, mat3_temp, mat4_temp, mat5_temp]) - # self.matplotlib_widget4.axis.legend(fontsize=13) + database.compare_b_h_curve(matplotlib_widget4, material_list=materials_used_list, temperature_list=temp_list) + matplotlib_widget4.axis.legend([f'{mat}, {temp}°C' for mat, temp in zip(materials_used_list, temp_list)], fontsize=10) matplotlib_widget4.axis.grid() matplotlib_widget4.figure.canvas.draw_idle() matplotlib_widget4.figure.tight_layout() + # Datasheet-Datasheet is finished self.statusBar().showMessage('Datasheet-Datasheet completed') @@ -1747,79 +1711,63 @@ def datupdateraph2(self, matplotlib_widget1, matplotlib_widget2): # show a statusbar while Measurement-Measurement is running self.statusBar().showMessage('Measurement-Measurement running...') QCoreApplication.processEvents() + # Show a statusbar while Measurement-Measurement is running + self.statusBar().showMessage('Measurement-Measurement running...') + QCoreApplication.processEvents() + + material_list = [self.dat_core_material1_comboBox_2.currentText(), + self.dat_core_material2_comboBox_2.currentText(), + self.dat_core_material3_comboBox_2.currentText(), + self.dat_core_material4_comboBox_2.currentText(), + self.dat_core_material5_comboBox_2.currentText()] + test_name_list = [self.test_name_1_comboBox.currentText(), + self.test_name_2_comboBox.currentText(), + self.test_name_3_comboBox.currentText(), + self.test_name_4_comboBox.currentText(), + self.test_name_5_comboBox.currentText()] + temp_list = [comma_str_to_point_float(self.aut_temp_m1_comboBox_2.currentText()), + comma_str_to_point_float(self.aut_temp_m2_comboBox_2.currentText()), + comma_str_to_point_float(self.aut_temp_m3_comboBox_2.currentText()), + comma_str_to_point_float(self.aut_temp_m4_comboBox_2.currentText()), + comma_str_to_point_float(self.aut_temp_m5_comboBox_2.currentText())] + freq_list = [comma_str_to_point_float(self.aut_freq_m1_comboBox.currentText()), + comma_str_to_point_float(self.aut_freq_m2_comboBox.currentText()), + comma_str_to_point_float(self.aut_freq_m3_comboBox.currentText()), + comma_str_to_point_float(self.aut_freq_m4_comboBox.currentText()), + comma_str_to_point_float(self.aut_freq_m5_comboBox.currentText())] + + materials_used_list = [item for item in material_list if item] + + # First plot: uR/u0 vs B (Real Part) matplotlib_widget1.axis.clear() self.layout = QVBoxLayout(self.plotwidget_13) self.layout.addWidget(matplotlib_widget1) - try: - matplotlib_widget1.axis_cm.remove() - except: - pass - - mat1_name = self.dat_core_material1_comboBox_2.currentText() - mat2_name = self.dat_core_material2_comboBox_2.currentText() - mat3_name = self.dat_core_material3_comboBox_2.currentText() - mat4_name = self.dat_core_material4_comboBox_2.currentText() - mat5_name = self.dat_core_material5_comboBox_2.currentText() - - mat1_test_name = self.test_name_1_comboBox.currentText() - mat2_test_name = self.test_name_2_comboBox.currentText() - mat3_test_name = self.test_name_3_comboBox.currentText() - mat4_test_name = self.test_name_4_comboBox.currentText() - mat5_test_name = self.test_name_5_comboBox.currentText() - - mat1_temp = comma_str_to_point_float(self.aut_temp_m1_comboBox_2.currentText()) - mat2_temp = comma_str_to_point_float(self.aut_temp_m2_comboBox_2.currentText()) - mat3_temp = comma_str_to_point_float(self.aut_temp_m3_comboBox_2.currentText()) - mat4_temp = comma_str_to_point_float(self.aut_temp_m4_comboBox_2.currentText()) - mat5_temp = comma_str_to_point_float(self.aut_temp_m5_comboBox_2.currentText()) - - mat1_freq = comma_str_to_point_float(self.aut_freq_m1_comboBox.currentText()) - mat2_freq = comma_str_to_point_float(self.aut_freq_m2_comboBox.currentText()) - mat3_freq = comma_str_to_point_float(self.aut_freq_m3_comboBox.currentText()) - mat4_freq = comma_str_to_point_float(self.aut_freq_m4_comboBox.currentText()) - mat5_freq = comma_str_to_point_float(self.aut_freq_m5_comboBox.currentText()) - - # print(f"mat1_name: {mat1_name},{mat2_name},{mat3_name},{mat4_name},{mat5_name}") - # print(f"mat1_temp: {mat1_temp},{mat2_temp},{mat3_temp},{mat4_temp},{mat5_temp}") - # print(f"mat1_freq: {mat1_freq},{mat2_freq},{mat3_freq},{mat4_freq},{mat5_freq}") - - materials_used_list = [] - material_list = [mat1_name, mat2_name, mat3_name, mat4_name, mat5_name] - for items in material_list: - if items: - materials_used_list.append(items) - # print(materials_used_list) - database.compare_permeability_measurement_data(matplotlib_widget1, material_list=materials_used_list, - measurement_name=[mat1_test_name, mat2_test_name, mat3_test_name, - mat4_test_name, mat5_test_name], - frequency_list=[mat1_freq, mat2_freq, mat3_freq, mat4_freq, - mat5_freq], - temperature_list=[mat1_temp, mat2_temp, mat3_temp, mat4_temp, - mat5_temp], + measurement_name=test_name_list, + frequency_list=freq_list, + temperature_list=temp_list, plot_real_part=True) - + legend_labels1 = [f'{mat}, {test}, {freq} Hz, {temp}°C' for mat, test, freq, temp in zip(materials_used_list, test_name_list, freq_list, temp_list)] + matplotlib_widget1.axis.legend(legend_labels1, fontsize=8) + # legend_labels1 = [f'{mat}, {test}, {freq} Hz, {temp}°C' for mat, test, freq, temp in zip(materials_used_list, test_name_list, freq_list, temp_list)] + # matplotlib_widget1.axis.legend(legend_labels1, fontsize=8, loc='center left', bbox_to_anchor=(1, 0.5)) matplotlib_widget1.axis.grid() matplotlib_widget1.figure.canvas.draw_idle() matplotlib_widget1.figure.tight_layout() - ################################################################################################################ - + # Second plot: uR/u0 vs B (Imaginary Part) matplotlib_widget2.axis.clear() self.layout = QVBoxLayout(self.plotwidget_14) self.layout.addWidget(matplotlib_widget2) - try: - matplotlib_widget2.axis_cm.remove() - except: - pass database.compare_permeability_measurement_data(matplotlib_widget2, material_list=materials_used_list, - measurement_name=[mat1_test_name, mat2_test_name, mat3_test_name, - mat4_test_name, mat5_test_name], - frequency_list=[mat1_freq, mat2_freq, mat3_freq, mat4_freq, - mat5_freq], - temperature_list=[mat1_temp, mat2_temp, mat3_temp, mat4_temp, - mat5_temp], + measurement_name=test_name_list, + frequency_list=freq_list, + temperature_list=temp_list, plot_real_part=False) + legend_labels2 = [f'{mat}, {test}, {freq} Hz, {temp}°C' for mat, test, freq, temp in zip(materials_used_list, test_name_list, freq_list, temp_list)] + matplotlib_widget2.axis.legend(legend_labels2, fontsize=8) + # legend_labels2 = [f'{mat}, {test}, {freq} Hz, {temp}°C' for mat, test, freq, temp in zip(materials_used_list, test_name_list, freq_list, temp_list)] + # matplotlib_widget2.axis.legend(legend_labels2, fontsize=8, loc='center left', bbox_to_anchor=(1, 0.5)) matplotlib_widget2.axis.grid() matplotlib_widget2.figure.canvas.draw_idle() matplotlib_widget2.figure.tight_layout() @@ -1855,7 +1803,11 @@ def datupdateraph3(self, matplotlib_widget): database.compare_core_loss_flux_datasheet_measurement(matplotlib_widget, material=mat_name, temperature_list=[mat_dat_temp, mat_meas_temp], measurement_name=test_name) - + # TODO Review legend for some materials (PC200, DMR96A, and DMR96A2. + legend_labels = [f'{mat_name}, Datasheet, {mat_dat_temp}°C', f'{mat_name}, {test_name}, Measurement, {mat_meas_temp}°C'] + matplotlib_widget.axis.legend(legend_labels, fontsize=8) + # legend_labels = [f'{mat_name}, Datasheet {mat_dat_temp}°C', f'{mat_name}, Measurement {test_name}, {mat_meas_temp}°C'] + # matplotlib_widget.axis.legend(legend_labels, fontsize=8, loc='center left', bbox_to_anchor=(1, 0.5)) matplotlib_widget.axis.grid() matplotlib_widget.figure.canvas.draw_idle() matplotlib_widget.figure.tight_layout() From 98cfdaf1344aa9c70a08a17b12bcc5355a31c552 Mon Sep 17 00:00:00 2001 From: abujazar Date: Sat, 6 Jul 2024 22:18:21 +0200 Subject: [PATCH 03/11] adding temperature of materials to the core and the windings --- gui/femmt_gui.py | 12 +- gui/femmt_gui.ui | 282 +++++++++++++++++++++++++++-------------------- 2 files changed, 170 insertions(+), 124 deletions(-) diff --git a/gui/femmt_gui.py b/gui/femmt_gui.py index 673471fc..266277ee 100644 --- a/gui/femmt_gui.py +++ b/gui/femmt_gui.py @@ -1738,7 +1738,7 @@ def datupdateraph2(self, matplotlib_widget1, matplotlib_widget2): materials_used_list = [item for item in material_list if item] - # First plot: uR/u0 vs B (Real Part) + # First plot: (Real Part) matplotlib_widget1.axis.clear() self.layout = QVBoxLayout(self.plotwidget_13) self.layout.addWidget(matplotlib_widget1) @@ -1755,7 +1755,7 @@ def datupdateraph2(self, matplotlib_widget1, matplotlib_widget2): matplotlib_widget1.figure.canvas.draw_idle() matplotlib_widget1.figure.tight_layout() - # Second plot: uR/u0 vs B (Imaginary Part) + # Second plot: (Imaginary Part) matplotlib_widget2.axis.clear() self.layout = QVBoxLayout(self.plotwidget_14) self.layout.addWidget(matplotlib_widget2) @@ -2995,7 +2995,7 @@ def md_setup_geometry(self): core = fmt.Core(core_type=fmt.CoreType.Single, core_dimensions=core_dimensions, detailed_core_model=False, - material=material_enum, temperature=45, frequency=int(self.md_base_frequency_lineEdit.text()), + material=material_enum, temperature=int(self.md_core_temp_lineEdit.text()), frequency=int(self.md_base_frequency_lineEdit.text()), # permeability_datasource="manufacturer_datasheet", permeability_datasource=fmt.MaterialDataSource.Measurement, permeability_datatype=fmt.MeasurementDataType.ComplexPermeability, @@ -3127,7 +3127,7 @@ def md_setup_geometry(self): elif winding_material_name == 'Aluminium': winding_material_enum = fmt.Conductivity.Aluminium - winding = fmt.Conductor(0, winding_material_enum) + winding = fmt.Conductor(0, winding_material_enum, winding_material_temperature=int(self.md_winding1_temp_lineEdit.text())) scheme1 = getattr(fmt.ConductorArrangement, self.md_winding1_scheme_comboBox.currentText()) if self.md_winding1_type_comboBox.currentText() == self.translation_dict['solid']: winding.set_solid_round_conductor( @@ -3301,7 +3301,7 @@ def md_setup_geometry(self): elif winding1_material_name == 'Aluminium': winding1_material_enum = fmt.Conductivity.Aluminium - winding1 = fmt.Conductor(0, winding1_material_enum) + winding1 = fmt.Conductor(0, winding1_material_enum, winding_material_temperature=int(self.md_winding1_temp_lineEdit.text())) scheme1 = getattr(fmt.ConductorArrangement, self.md_winding1_scheme_comboBox.currentText()) if self.md_winding1_type_comboBox.currentText() == self.translation_dict['solid']: winding1.set_solid_round_conductor( @@ -3321,7 +3321,7 @@ def md_setup_geometry(self): elif winding2_material_name == 'Aluminium': winding2_material_enum = fmt.Conductivity.Aluminium - winding2 = fmt.Conductor(1, winding2_material_enum) + winding2 = fmt.Conductor(1, winding2_material_enum, winding_material_temperature=int(self.md_winding2_temp_lineEdit.text())) scheme2 = getattr(fmt.ConductorArrangement, self.md_winding2_scheme_comboBox.currentText()) if self.md_winding2_type_comboBox.currentText() == self.translation_dict['solid']: winding2.set_solid_round_conductor( diff --git a/gui/femmt_gui.ui b/gui/femmt_gui.ui index 50dfc6e7..a7704e9e 100644 --- a/gui/femmt_gui.ui +++ b/gui/femmt_gui.ui @@ -45,7 +45,7 @@ - 2 + 0 @@ -61,7 +61,7 @@ - 1 + 0 @@ -97,49 +97,45 @@ Core Definition - - + + - 0.012 + Material - + <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">2D axisymmetric core parameters</span></p></body></html> - - + + - Material + 0.012 - + 0.015 - - + + - <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Core from database</span></p></body></html> + Window Width [m] - - - - 0.0295 - - + + - + Qt::Horizontal @@ -152,31 +148,28 @@ - - - - - + + - Window Width [m] + Window Height [m] - - + + - Window Height [m] + <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Core from database</span></p></body></html> - - + + - Core inner diameter [m] + 0.0295 - + Qt::Horizontal @@ -189,10 +182,14 @@ - - + + + + Core inner diameter [m] + + - + Qt::Horizontal @@ -205,6 +202,9 @@ + + + @@ -218,6 +218,20 @@ + + + + Material temperature °C + + + + + + + 45 + + + @@ -227,47 +241,47 @@ Winding 1: Conductor Definition - - + + - - - - <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Manual wire parameters</span></p></body></html> - - + + - + Wire Radius [m] - - - - + 100e-6 - - + + + + <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Manual wire parameters</span></p></body></html> + + - + 150 - - + + + + + - Implicit + Wire Type @@ -278,60 +292,57 @@ - + + + + 0.6 + + + + 0.0013 - - + + - Wire Type + Implicit - - + + - 0.6 + Number Strands - + <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Litz from database</span></p></body></html> - + Fill Factor - + Strand Radius [m] - - - - Number Strands - - - - - - - - + + Qt::Horizontal @@ -344,7 +355,7 @@ - + Qt::Horizontal @@ -357,7 +368,7 @@ - + Qt::Horizontal @@ -369,6 +380,23 @@ + + + + + + + Material temperature °C + + + + + + + 45 + + + @@ -381,37 +409,54 @@ Winding 2: Conductor Definition - - + + + + + + + + - 35.5e-6 + Fill Factor - - + + - 0.0013 + <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Litz from database</span></p></body></html> - - + + - 0.6 + 600 - - + + + + 35.5e-6 + + - + Number Strands + + + + 0.6 + + + @@ -419,37 +464,44 @@ - - + + - Implicit + 0.0013 - + <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Manual wire parameters</span></p></body></html> - + Wire Radius [m] - + Strand Radius [m] - + + + + + Implicit + + + @@ -457,30 +509,24 @@ - - + + - <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Litz from database</span></p></body></html> + 45 - - + + - 600 + Material temperature °C - - - - - - - - - - Fill Factor + + + + true @@ -4582,7 +4628,7 @@ 0 0 - 98 + 635 518 @@ -4754,7 +4800,7 @@ 0 0 - 98 + 468 518 @@ -4981,7 +5027,7 @@ - 0 + 1 @@ -9603,7 +9649,7 @@ 0 0 - 98 + 1403 1024 From 47b3ba9de52467cbc67749f2966c6d0e3430aa37 Mon Sep 17 00:00:00 2001 From: abujazar Date: Sun, 7 Jul 2024 00:17:16 +0200 Subject: [PATCH 04/11] add measurment-datasheet source in core --- gui/femmt_gui.py | 38 ++++++++++++++++++++++----- gui/femmt_gui.ui | 67 ++++++++++++++++++++++++++++++++++++------------ 2 files changed, 81 insertions(+), 24 deletions(-) diff --git a/gui/femmt_gui.py b/gui/femmt_gui.py index 266277ee..fbdea7a9 100644 --- a/gui/femmt_gui.py +++ b/gui/femmt_gui.py @@ -2231,6 +2231,8 @@ def md_initialize_controls(self) -> None: # List all materials from database get_material_list = database.material_list_in_database() md_core_material_options = get_material_list + # Material data Source for permeability and permittivity + data_source_options = [source for source in fmt.MaterialDataSource] md_winding_material_options = [key for key in fmt.wire_material_database()] md_winding_type_options = [self.translation_dict['litz'], self.translation_dict['solid']] @@ -2265,6 +2267,10 @@ def md_initialize_controls(self) -> None: self.md_simulation_type_comboBox.addItem(option) for option in md_core_material_options: self.md_core_material_comboBox.addItem(option) + for option in data_source_options: + self.md_permeability_datasource_combobox.addItem(option) + for option in data_source_options: + self.md_permittivity_datasource_combobox.addItem(option) for option in md_winding_material_options: self.md_winding1_material_comboBox.addItem(option) self.md_winding2_material_comboBox.addItem(option) @@ -2506,6 +2512,7 @@ def md_set_core_geometry_from_database(self): self.md_core_width_lineEdit.setText(str(format_number(core["core_inner_diameter"]))) self.md_window_height_lineEdit.setText(str(format_number(core["window_h"]))) self.md_window_width_lineEdit.setText(str(format_number(core["window_w"]))) + self.md_core_width_lineEdit.setEnabled(False) self.md_window_height_lineEdit.setEnabled(False) self.md_window_width_lineEdit.setEnabled(False) @@ -2991,16 +2998,18 @@ def md_setup_geometry(self): core_h=1) material_enum = fmt.Material(self.md_core_material_comboBox.currentText()) + permeability_datasource_enum = fmt.MaterialDataSource(self.md_permeability_datasource_combobox.currentText()) + permittivity_datasource_enum = fmt.MaterialDataSource(self.md_permittivity_datasource_combobox.currentText()) core = fmt.Core(core_type=fmt.CoreType.Single, core_dimensions=core_dimensions, detailed_core_model=False, material=material_enum, temperature=int(self.md_core_temp_lineEdit.text()), frequency=int(self.md_base_frequency_lineEdit.text()), # permeability_datasource="manufacturer_datasheet", - permeability_datasource=fmt.MaterialDataSource.Measurement, + permeability_datasource=permeability_datasource_enum, permeability_datatype=fmt.MeasurementDataType.ComplexPermeability, permeability_measurement_setup=mdb.MeasurementSetup.LEA_LK, - permittivity_datasource=fmt.MaterialDataSource.Measurement, + permittivity_datasource=permittivity_datasource_enum, permittivity_datatype=fmt.MeasurementDataType.ComplexPermittivity, permittivity_measurement_setup=mdb.MeasurementSetup.LEA_LK, mdb_verbosity=fmt.Verbosity.Silent) @@ -3160,7 +3169,8 @@ def md_setup_geometry(self): # 1. chose simulation type geo = fmt.MagneticComponent(component_type=fmt.ComponentType.Transformer, - working_directory=self.md_working_directory_lineEdit.text()) + working_directory=self.md_working_directory_lineEdit.text(), + verbosity=fmt.Verbosity.ToConsole) # ----------------------------------------------- # Core @@ -3169,10 +3179,24 @@ def md_setup_geometry(self): window_w=comma_str_to_point_float(self.md_window_width_lineEdit.text()), window_h=comma_str_to_point_float(self.md_window_height_lineEdit.text()), core_h=0.04) - core = fmt.Core(core_dimensions=core_dimensions, mu_r_abs=3100, phi_mu_deg=12, sigma=1.2, - permeability_datasource=fmt.MaterialDataSource.Custom, - permittivity_datasource=fmt.MaterialDataSource.Custom, - detailed_core_model=False) + material_enum = fmt.Material(self.md_core_material_comboBox.currentText()) + permeability_datasource_enum = fmt.MaterialDataSource(self.md_permeability_datasource_combobox.currentText()) + permittivity_datasource_enum = fmt.MaterialDataSource(self.md_permittivity_datasource_combobox.currentText()) + core = fmt.Core(core_type=fmt.CoreType.Single, + core_dimensions=core_dimensions, + detailed_core_model=False, + material=material_enum, temperature=int(self.md_core_temp_lineEdit.text()), frequency=int(self.md_base_frequency_lineEdit.text()), + # permeability_datasource="manufacturer_datasheet", + permeability_datasource=permeability_datasource_enum, + permeability_datatype=fmt.MeasurementDataType.ComplexPermeability, + permeability_measurement_setup=mdb.MeasurementSetup.LEA_LK, + permittivity_datasource=permittivity_datasource_enum, + permittivity_datatype=fmt.MeasurementDataType.ComplexPermittivity, + permittivity_measurement_setup=mdb.MeasurementSetup.LEA_LK, mdb_verbosity=fmt.Verbosity.Silent) + # core = fmt.Core(core_dimensions=core_dimensions, mu_r_abs=3100, phi_mu_deg=12, sigma=1.2, + # permeability_datasource=permeability_datasource_enum, + # permittivity_datasource=permittivity_datasource_enum, + # detailed_core_model=False) geo.set_core(core) """ geo.core.update(window_h = comma_str_to_point_float(self.md_window_height_lineEdit.text()), diff --git a/gui/femmt_gui.ui b/gui/femmt_gui.ui index a7704e9e..d59c53f2 100644 --- a/gui/femmt_gui.ui +++ b/gui/femmt_gui.ui @@ -111,21 +111,21 @@ - + 0.012 - + 0.015 - + Window Width [m] @@ -135,7 +135,7 @@ - + Qt::Horizontal @@ -148,7 +148,7 @@ - + Window Height [m] @@ -162,7 +162,7 @@ - + 0.0295 @@ -182,14 +182,14 @@ - + Core inner diameter [m] - + Qt::Horizontal @@ -205,8 +205,29 @@ + + + + 45 + + + + + + + Material temperature °C + + + - + + + Permeability source + + + + + Qt::Horizontal @@ -218,19 +239,31 @@ - - + + + + + + + + - Material temperature °C + Permittivity source - - - - 45 + + + + Qt::Horizontal - + + + 40 + 20 + + + From 9ec87de68eda0a636dd147fdf88f7efbdee1ac9d Mon Sep 17 00:00:00 2001 From: abujazar Date: Sun, 7 Jul 2024 00:25:49 +0200 Subject: [PATCH 05/11] removing custom from choosing --- gui/femmt_gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/femmt_gui.py b/gui/femmt_gui.py index fbdea7a9..d33ebb32 100644 --- a/gui/femmt_gui.py +++ b/gui/femmt_gui.py @@ -2232,7 +2232,7 @@ def md_initialize_controls(self) -> None: get_material_list = database.material_list_in_database() md_core_material_options = get_material_list # Material data Source for permeability and permittivity - data_source_options = [source for source in fmt.MaterialDataSource] + data_source_options = [source for source in fmt.MaterialDataSource if source != fmt.MaterialDataSource.Custom] md_winding_material_options = [key for key in fmt.wire_material_database()] md_winding_type_options = [self.translation_dict['litz'], self.translation_dict['solid']] From fc9e4adfc18de3a810f1cc4a8dd990d41b184937 Mon Sep 17 00:00:00 2001 From: abujazar Date: Sun, 7 Jul 2024 02:51:42 +0200 Subject: [PATCH 06/11] adding the dependencies of materials and setup names. Also the dependencies of sources and setup names --- gui/femmt_gui.py | 52 +++++++++++++++++++++++-- gui/femmt_gui.ui | 98 +++++++++++++++++++++++++++++++++++------------- 2 files changed, 120 insertions(+), 30 deletions(-) diff --git a/gui/femmt_gui.py b/gui/femmt_gui.py index d33ebb32..636e9c8b 100644 --- a/gui/femmt_gui.py +++ b/gui/femmt_gui.py @@ -245,6 +245,11 @@ def __init__(self, parent=None): self.md_simulation_type_comboBox.currentTextChanged.connect(self.md_change_simulation_type) # update dc and frequencies boxes based on the simulation type. self.md_simulation_type_comboBox.currentTextChanged.connect(self.update_dc_and_frequencies_checkboxes) + # Materials with setup name + self.md_core_material_comboBox.currentIndexChanged.connect(self.md_test_setup_name) + # self.md_core_material_comboBox.currentIndexChanged.connect(self.md_test_setup_name_enable) + self.md_permeability_datasource_combobox.currentIndexChanged.connect(self.md_test_setup_name_enable) + self.md_permittivity_datasource_combobox.currentIndexChanged.connect(self.md_test_setup_name_enable) # core self.md_core_geometry_comboBox.currentTextChanged.connect(self.md_set_core_geometry_from_database) @@ -2521,6 +2526,41 @@ def md_set_core_geometry_from_database(self): self.md_window_height_lineEdit.setEnabled(True) self.md_window_width_lineEdit.setEnabled(True) + def md_test_setup_name(self): + """Get test setup names from database for particular material.""" + mat_text1 = self.md_core_material_comboBox.currentText() + self.md_test_name1_comboBox.clear() + self.md_test_name2_comboBox.clear() + + names_list = [] + + if mat_text1: + names_list = database.find_measurement_names(material_name=mat_text1, datatype="complex_permeability") + + for option in names_list: + self.md_test_name1_comboBox.addItem(option) + self.md_test_name2_comboBox.addItem(option) + + def md_test_setup_name_enable(self): + """Enable or disable the test name combo box based on the data source.""" + # material = self.md_core_material_comboBox.currentText() + permeability_source = self.md_permeability_datasource_combobox.currentText() + permittivity_source = self.md_permittivity_datasource_combobox.currentText() + # Hide the comboboxes and labels if it is datasheet + self.md_test_name1_comboBox.setVisible(permeability_source == "measurements") + self.md_test_name2_comboBox.setVisible(permittivity_source == "measurements") + self.md_test_name1_label.setVisible(permeability_source == "measurements") + self.md_test_name2_label.setVisible(permittivity_source == "measurements") + + # if permeability_source == "measurements": + # self.md_test_name1_comboBox.setEnabled(True) + # else: + # self.md_test_name1_comboBox.setEnabled(False) + # if permittivity_source == "measurements": + # self.md_test_name2_comboBox.setEnabled(True) + # else: + # self.md_test_name2_comboBox.setEnabled(False) + def md_winding1_set_litz_parameters_from_litz_database(self): """Set litz parameters from material database for winding 1 in manual design.""" litz_dict = fmt.litz_database() @@ -3000,6 +3040,8 @@ def md_setup_geometry(self): material_enum = fmt.Material(self.md_core_material_comboBox.currentText()) permeability_datasource_enum = fmt.MaterialDataSource(self.md_permeability_datasource_combobox.currentText()) permittivity_datasource_enum = fmt.MaterialDataSource(self.md_permittivity_datasource_combobox.currentText()) + permeability_measurement_setup_enum = mdb.MeasurementSetup(self.md_test_name1_comboBox.currentText()) + permittivity_measurement_setup_enum = mdb.MeasurementSetup(self.md_test_name2_comboBox.currentText()) core = fmt.Core(core_type=fmt.CoreType.Single, core_dimensions=core_dimensions, @@ -3008,10 +3050,10 @@ def md_setup_geometry(self): # permeability_datasource="manufacturer_datasheet", permeability_datasource=permeability_datasource_enum, permeability_datatype=fmt.MeasurementDataType.ComplexPermeability, - permeability_measurement_setup=mdb.MeasurementSetup.LEA_LK, + permeability_measurement_setup=permeability_measurement_setup_enum, permittivity_datasource=permittivity_datasource_enum, permittivity_datatype=fmt.MeasurementDataType.ComplexPermittivity, - permittivity_measurement_setup=mdb.MeasurementSetup.LEA_LK, mdb_verbosity=fmt.Verbosity.Silent) + permittivity_measurement_setup=permittivity_measurement_setup_enum, mdb_verbosity=fmt.Verbosity.Silent) geo.set_core(core) @@ -3182,6 +3224,8 @@ def md_setup_geometry(self): material_enum = fmt.Material(self.md_core_material_comboBox.currentText()) permeability_datasource_enum = fmt.MaterialDataSource(self.md_permeability_datasource_combobox.currentText()) permittivity_datasource_enum = fmt.MaterialDataSource(self.md_permittivity_datasource_combobox.currentText()) + permeability_measurement_setup_enum = mdb.MeasurementSetup(self.md_test_name1_comboBox.currentText()) + permittivity_measurement_setup_enum = mdb.MeasurementSetup(self.md_test_name2_comboBox.currentText()) core = fmt.Core(core_type=fmt.CoreType.Single, core_dimensions=core_dimensions, detailed_core_model=False, @@ -3189,10 +3233,10 @@ def md_setup_geometry(self): # permeability_datasource="manufacturer_datasheet", permeability_datasource=permeability_datasource_enum, permeability_datatype=fmt.MeasurementDataType.ComplexPermeability, - permeability_measurement_setup=mdb.MeasurementSetup.LEA_LK, + permeability_measurement_setup=permeability_measurement_setup_enum, permittivity_datasource=permittivity_datasource_enum, permittivity_datatype=fmt.MeasurementDataType.ComplexPermittivity, - permittivity_measurement_setup=mdb.MeasurementSetup.LEA_LK, mdb_verbosity=fmt.Verbosity.Silent) + permittivity_measurement_setup=permittivity_measurement_setup_enum, mdb_verbosity=fmt.Verbosity.Silent) # core = fmt.Core(core_dimensions=core_dimensions, mu_r_abs=3100, phi_mu_deg=12, sigma=1.2, # permeability_datasource=permeability_datasource_enum, # permittivity_datasource=permittivity_datasource_enum, diff --git a/gui/femmt_gui.ui b/gui/femmt_gui.ui index d59c53f2..16817dc3 100644 --- a/gui/femmt_gui.ui +++ b/gui/femmt_gui.ui @@ -104,38 +104,38 @@ - + <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">2D axisymmetric core parameters</span></p></body></html> - + 0.012 - + 0.015 - + Window Width [m] - + - + Qt::Horizontal @@ -148,28 +148,28 @@ - + Window Height [m] - + <html><head/><body><p><span style=" font-weight:600; color:#1c71d8;">Core from database</span></p></body></html> - + 0.0295 - + Qt::Horizontal @@ -182,14 +182,14 @@ - + Core inner diameter [m] - + Qt::Horizontal @@ -219,13 +219,6 @@ - - - - Permeability source - - - @@ -239,21 +232,74 @@ - - + + + + Qt::Horizontal + + + + 40 + 20 + + + - + - + + + + Permeability source + + + + Permittivity source - - + + + + + + + Permeability setup + + + + + + + + + + Permittivity setup + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + Qt::Horizontal @@ -5060,7 +5106,7 @@ - 1 + 0 From 659b8c9feef5eaab3b8920fdb36489cff6dfe14f Mon Sep 17 00:00:00 2001 From: abujazar Date: Tue, 9 Jul 2024 23:10:43 +0200 Subject: [PATCH 07/11] change names of inductance value --- gui/femmt_gui.ui | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gui/femmt_gui.ui b/gui/femmt_gui.ui index 16817dc3..033e3160 100644 --- a/gui/femmt_gui.ui +++ b/gui/femmt_gui.ui @@ -1098,7 +1098,7 @@ - Results + reluctance model @@ -1110,7 +1110,7 @@ - Inductance value + Calculate Inductane @@ -4707,7 +4707,7 @@ 0 0 - 635 + 98 518 @@ -4879,7 +4879,7 @@ 0 0 - 468 + 98 518 @@ -4934,8 +4934,8 @@ 0 0 - 1440 - 1172 + 268 + 253 @@ -5065,8 +5065,8 @@ 0 0 - 1400 - 807 + 98 + 518 @@ -5136,7 +5136,7 @@ 0 0 - 1403 + 98 2036 @@ -9728,7 +9728,7 @@ 0 0 - 1403 + 98 1024 From 2449581a1c20ca48191dc41e271564395ffc92b7 Mon Sep 17 00:00:00 2001 From: abujazar Date: Tue, 9 Jul 2024 23:12:23 +0200 Subject: [PATCH 08/11] edit name again of inductance box --- gui/femmt_gui.ui | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gui/femmt_gui.ui b/gui/femmt_gui.ui index 033e3160..23d7f08d 100644 --- a/gui/femmt_gui.ui +++ b/gui/femmt_gui.ui @@ -1098,7 +1098,7 @@ - reluctance model + Reluctance model @@ -4934,8 +4934,8 @@ 0 0 - 268 - 253 + 1440 + 1172 @@ -5065,8 +5065,8 @@ 0 0 - 98 - 518 + 1400 + 807 @@ -5136,7 +5136,7 @@ 0 0 - 98 + 1403 2036 From 0b316bfadf4fe30562a6b195ac5ace2b90e5086d Mon Sep 17 00:00:00 2001 From: abujazar Date: Tue, 9 Jul 2024 23:16:25 +0200 Subject: [PATCH 09/11] fix pycodestyle --- gui/femmt_gui.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/femmt_gui.py b/gui/femmt_gui.py index 636e9c8b..a6094bfc 100644 --- a/gui/femmt_gui.py +++ b/gui/femmt_gui.py @@ -1635,10 +1635,11 @@ def datupdateraph1(self, matplotlib_widget1, matplotlib_widget2, matplotlib_widg # show a statusbar while Datasheet-Datasheet is running self.statusBar().showMessage('Datasheet-Datasheet running...') QCoreApplication.processEvents() + try: - matplotlib_widget1.axis_cm.remove() + matplotlib_widget1.axis_cm.remove() except: - pass + pass material_list = [self.dat_core_material1_comboBox.currentText(), self.dat_core_material2_comboBox.currentText(), @@ -1656,7 +1657,6 @@ def datupdateraph1(self, matplotlib_widget1, matplotlib_widget2, matplotlib_widg comma_str_to_point_float(self.aut_flux_m4_comboBox.currentText()), comma_str_to_point_float(self.aut_flux_m5_comboBox.currentText())] - materials_used_list = [item for item in material_list if item] # First plot: Relative power loss vs B matplotlib_widget1.axis.clear() From d3e9777806e1966f8b87efff1f3b719c332a71ea Mon Sep 17 00:00:00 2001 From: abujazar Date: Fri, 12 Jul 2024 12:14:24 +0200 Subject: [PATCH 10/11] =?UTF-8?q?=20show=20m,=20n,=20=C2=B5H=20or=2010e-3?= =?UTF-8?q?=20and=20so=20on=20instead=20of=20a=20long=20float=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gui/femmt_gui.py | 62 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/gui/femmt_gui.py b/gui/femmt_gui.py index a6094bfc..f1287534 100644 --- a/gui/femmt_gui.py +++ b/gui/femmt_gui.py @@ -83,6 +83,30 @@ def format_number(value, decimals=4): """ return round(value, decimals) +def format_number_with_units(value, decimals=4): + """ + Format a number to a readable string with appropriate units. + + :param value: The value to format. + :type value: float + :param decimals: Number of decimal places to round to. + :type decimals: int + :return: Formatted string with units. + :rtype: str + """ + if value >= 1: + return f"{round(value, decimals)}" + elif value >= 1e-3: + return f"{round(value * 1e3, decimals)} m" + elif value >= 1e-6: + return f"{round(value * 1e6, decimals)} µ" + elif value >= 1e-9: + return f"{round(value * 1e9, decimals)} n" + elif value >= 1e-12: + return f"{round(value * 1e12, decimals)} p" + else: + return f"{round(value, decimals)}" + def comma_str_to_point_float(input_str: str) -> float: """ Workaround to convert a comma (depends on the user input) in a point (needed for python). @@ -3530,27 +3554,31 @@ def md_action_run_simulation(self, *args, **kwargs) -> None: # just for shown one figure: self.md_loss_plot_label1.setPixmap(pixmap) self.md_loss_plot_label1.show() - # # loss labels - # hysteresis_label.setText(f"Core Hysteresis loss: {sweep.get('core_hyst_losses', 0)} W") - # eddy_current_label.setText(f"Core Eddy Current loss: {sweep.get('core_eddy_losses', 0)} W") - # winding1_loss_label.setText(f"Winding 1 loss: {sweep['winding1'].get('winding_losses', 0)} W") - # inductance1_label.setText(f"Primary Inductance: {sweep['winding1'].get('flux_over_current', [0])[0]} H") - # # transformer case + # # Show the losses with round and approximation. + # hysteresis_label.setText(f"Core Hysteresis loss: {sweep.get('core_hyst_losses', 0):.5f} W") + # eddy_current_label.setText(f"Core Eddy Current loss: {sweep.get('core_eddy_losses', 0):.5f} W") + # winding1_loss_label.setText(f"Winding 1 loss: {sweep['winding1'].get('winding_losses', 0):.5f} W") + # + # primary_inductance_nh = sweep['winding1'].get('flux_over_current', [0])[0] * 1e9 + # inductance1_label.setText(f"Primary Inductance: {primary_inductance_nh:.0f} nH") + # # Transformer case. # if self.md_simulation_type_comboBox.currentText() == self.translation_dict['transformer']: - # winding2_loss_label.setText(f"Winding 2 loss: {sweep['winding2'].get('winding_losses', 0)} W") - # inductance2_label.setText(f"Secondary Inductance: {sweep['winding2'].get('flux_over_current', [0])[0]} H") - # Show the losses with round and approximation. - hysteresis_label.setText(f"Core Hysteresis loss: {sweep.get('core_hyst_losses', 0):.5f} W") - eddy_current_label.setText(f"Core Eddy Current loss: {sweep.get('core_eddy_losses', 0):.5f} W") - winding1_loss_label.setText(f"Winding 1 loss: {sweep['winding1'].get('winding_losses', 0):.5f} W") + # secondary_inductance_nh = sweep['winding2'].get('flux_over_current', [0])[0] * 1e9 + # winding2_loss_label.setText(f"Winding 2 loss: {sweep['winding2'].get('winding_losses', 0):.0f} W") + # inductance2_label.setText(f"Secondary Inductance: {secondary_inductance_nh:.5f} nH") + # Show the losses with the new format_number_with_units function. + hysteresis_label.setText(f"Core Hysteresis loss: {format_number_with_units(sweep.get('core_hyst_losses', 0))} W") + eddy_current_label.setText(f"Core Eddy Current loss: {format_number_with_units(sweep.get('core_eddy_losses', 0))} W") + winding1_loss_label.setText(f"Winding 1 loss: {format_number_with_units(sweep['winding1'].get('winding_losses', 0))} W") primary_inductance_nh = sweep['winding1'].get('flux_over_current', [0])[0] * 1e9 inductance1_label.setText(f"Primary Inductance: {primary_inductance_nh:.0f} nH") # Transformer case. if self.md_simulation_type_comboBox.currentText() == self.translation_dict['transformer']: - secondary_inductance_nh = sweep['winding2'].get('flux_over_current', [0])[0] * 1e9 - winding2_loss_label.setText(f"Winding 2 loss: {sweep['winding2'].get('winding_losses', 0):.0f} W") - inductance2_label.setText(f"Secondary Inductance: {secondary_inductance_nh:.5f} nH") + secondary_inductance_nh = sweep['winding2'].get('flux_over_current', [0])[0] + winding2_loss_label.setText(f"Winding 2 loss: {format_number_with_units(sweep['winding2'].get('winding_losses', 0))} W") + inductance2_label.setText(f"Secondary Inductance: {format_number_with_units(secondary_inductance_nh, decimals=4)} H") + finally: # Unlock the mutex to allow other operations to proceed. self.mutex.unlock() @@ -3673,7 +3701,9 @@ def inductancecalc(self, *args, **kwargs): mc1.calculate_inductance() inductance = mc1.data_matrix[:, 9] - self.Inductanceval_label.setText(f"{round(inductance[0], 10)} H") + #self.Inductanceval_label.setText(f"{round(inductance[0], 10)} H") + formatted_inductance = format_number_with_units(inductance[0], 4) + " H" + self.Inductanceval_label.setText(formatted_inductance) # Completed self.statusBar().showMessage('Inductance Value completed') From 84941c54f42f380c318aca1b4a2a148b91952e24 Mon Sep 17 00:00:00 2001 From: abujazar Date: Fri, 12 Jul 2024 12:20:40 +0200 Subject: [PATCH 11/11] fixing pytest --- gui/femmt_gui.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gui/femmt_gui.py b/gui/femmt_gui.py index f1287534..524b168c 100644 --- a/gui/femmt_gui.py +++ b/gui/femmt_gui.py @@ -3700,8 +3700,7 @@ def inductancecalc(self, *args, **kwargs): mc1.calculate_inductance() inductance = mc1.data_matrix[:, 9] - - #self.Inductanceval_label.setText(f"{round(inductance[0], 10)} H") + # self.Inductanceval_label.setText(f"{round(inductance[0], 10)} H") formatted_inductance = format_number_with_units(inductance[0], 4) + " H" self.Inductanceval_label.setText(formatted_inductance)